1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: join => join_path

This commit is contained in:
yuyi
2020-03-09 09:23:34 +08:00
committed by GitHub
parent e3687dc257
commit 876b73f92c
23 changed files with 62 additions and 62 deletions

View File

@@ -97,7 +97,7 @@ fn worker_trunner(p mut sync.PoolProcessor, idx int, thread_id int) voidptr {
// Remove them after a test passes/fails.
fname := os.filename(file)
generated_binary_fname := if os.user_os() == 'windows' { fname.replace('.v', '.exe') } else { fname.replace('.v', '') }
generated_binary_fpath := os.join(tmpd,generated_binary_fname)
generated_binary_fpath := os.join_path(tmpd, generated_binary_fname)
if os.exists(generated_binary_fpath) {
os.rm(generated_binary_fpath)
}
@@ -152,7 +152,7 @@ fn worker_trunner(p mut sync.PoolProcessor, idx int, thread_id int) voidptr {
}
pub fn vlib_should_be_present(parent_dir string) {
vlib_dir := os.join(parent_dir,'vlib')
vlib_dir := os.join_path(parent_dir,'vlib')
if !os.is_dir(vlib_dir) {
eprintln('$vlib_dir is missing, it must be next to the V executable')
exit(1)
@@ -169,7 +169,7 @@ pub fn v_build_failing(zargs string, folder string) bool {
eheader(main_label)
eprintln('v compiler args: "$vargs"')
mut session := new_test_session(vargs)
files := os.walk_ext(os.join(parent_dir,folder), '.v')
files := os.walk_ext(os.join_path(parent_dir, folder), '.v')
mut mains := []string
for f in files {
if !f.contains('modules') && !f.contains('preludes') {

View File

@@ -64,7 +64,7 @@ pub fn prepare_vc_source(vcdir string, cdir string, commit string) (string,strin
pub fn clone_or_pull( remote_git_url string, local_worktree_path string ) {
// NB: after clone_or_pull, the current repo branch is === HEAD === master
if os.is_dir( local_worktree_path ) && os.is_dir(os.join(local_worktree_path,'.git')) {
if os.is_dir(local_worktree_path) && os.is_dir(os.join_path(local_worktree_path, '.git')) {
// Already existing ... Just pulling in this case is faster usually.
scripting.run('git -C "$local_worktree_path" checkout --quiet master')
scripting.run('git -C "$local_worktree_path" pull --quiet ')
@@ -96,7 +96,7 @@ pub mut:
pub fn (vgit_context mut VGitContext) compile_oldv_if_needed() {
vgit_context.vexename = if os.user_os() == 'windows' { 'v.exe' } else { 'v' }
vgit_context.vexepath = os.realpath( os.join(vgit_context.path_v, vgit_context.vexename) )
vgit_context.vexepath = os.realpath(os.join_path(vgit_context.path_v, vgit_context.vexename))
mut command_for_building_v_from_c_source := ''
mut command_for_selfbuilding := ''
if 'windows' == os.user_os() {

View File

@@ -14,7 +14,7 @@ fn main() {
exit(1)
}
if testing.v_build_failing(params + '-live', os.join( 'examples', 'hot_reload')){
if testing.v_build_failing(params + '-live', os.join_path( 'examples', 'hot_reload')){
exit(1)
}

View File

@@ -155,7 +155,7 @@ fn (foptions &FormatOptions) format_file(file string) {
file_ast := parser.parse_file(file, table, .parse_comments)
formatted_content := fmt.fmt(file_ast, table)
file_name := os.filename(file)
vfmt_output_path := os.join(os.tmpdir(), 'vfmt_' + file_name)
vfmt_output_path := os.join_path(os.tmpdir(), 'vfmt_' + file_name)
os.write_file(vfmt_output_path, formatted_content )
if foptions.is_verbose {
eprintln('vfmt2 fmt.fmt worked and ${formatted_content.len} bytes were written to ${vfmt_output_path} .')
@@ -187,7 +187,7 @@ fn (foptions &FormatOptions) format_file(file string) {
// vfmt implementation.
mod_folder_parent = os.base_dir(mod_folder)
mut main_program_content := if mod_name == 'builtin' || mod_name == 'main' { 'fn main(){}\n' } else { 'import ${mod_name}\n' + 'fn main(){}\n' }
main_program_file := os.join(tmpfolder,'vfmt_tmp_${mod_name}_program.v')
main_program_file := os.join_path(tmpfolder,'vfmt_tmp_${mod_name}_program.v')
if os.exists(main_program_file) {
os.rm(main_program_file)
}
@@ -391,7 +391,7 @@ fn get_compile_name_of_potential_v_project(file string) string {
}
mut vfiles := []string
for f in all_files_in_pfolder {
vf := os.join(pfolder,f)
vf := os.join_path(pfolder, f)
if f.starts_with('.') || !f.ends_with('.v') || os.is_dir(vf) {
continue
}

View File

@@ -176,7 +176,7 @@ fn vpm_install(module_names []string) {
println('Skipping module "$name", since it uses an unsupported VCS {$vcs} .')
continue
}
final_module_path := os.realpath(os.join(settings.vmodules_path,mod.name.replace('.', os.path_separator)))
final_module_path := os.realpath(os.join_path(settings.vmodules_path,mod.name.replace('.', os.path_separator)))
if os.exists(final_module_path) {
vpm_update([name])
continue
@@ -277,7 +277,7 @@ fn vpm_remove(module_names []string) {
os.rmdir_all(final_module_path)
// delete author directory if it is empty
author := name.split('.')[0]
author_dir := os.realpath(os.join(settings.vmodules_path,author))
author_dir := os.realpath(os.join_path(settings.vmodules_path,author))
if os.is_dir_empty(author_dir) {
verbose_println('removing author folder $author_dir')
os.rmdir(author_dir)
@@ -286,7 +286,7 @@ fn vpm_remove(module_names []string) {
}
fn valid_final_path_of_existing_module(name string) ?string {
name_of_vmodules_folder := os.join(settings.vmodules_path,name.replace('.', os.path_separator))
name_of_vmodules_folder := os.join_path(settings.vmodules_path,name.replace('.', os.path_separator))
final_module_path := os.realpath(name_of_vmodules_folder)
if !os.exists(final_module_path) {
println('No module with name "$name" exists at $name_of_vmodules_folder')
@@ -325,7 +325,7 @@ fn vpm_help(module_names []string) {
fn vcs_used_in_dir(dir string) ?[]string {
mut vcs := []string
for repo_subfolder in supported_vcs_folders {
checked_folder := os.realpath(os.join(dir,repo_subfolder))
checked_folder := os.realpath(os.join_path(dir,repo_subfolder))
if os.is_dir(checked_folder) {
vcs << repo_subfolder.replace('.', '')
}
@@ -342,7 +342,7 @@ fn get_installed_modules() []string {
}
mut modules := []string
for dir in dirs {
adir := os.join(settings.vmodules_path,dir)
adir := os.join_path(settings.vmodules_path, dir)
if dir in excluded_dirs || !os.is_dir(adir) {
continue
}
@@ -351,7 +351,7 @@ fn get_installed_modules() []string {
continue
}
for m in mods {
vcs_used_in_dir(os.join(adir,m)) or {
vcs_used_in_dir(os.join_path(adir, m)) or {
continue
}
modules << '${author}.$m'
@@ -399,7 +399,7 @@ fn get_all_modules() []string {
}
fn resolve_dependencies(name, module_path string, module_names []string) {
vmod_path := os.join(module_path,'v.mod')
vmod_path := os.join_path(module_path, 'v.mod')
if !os.exists(vmod_path) {
return
}

View File

@@ -77,8 +77,8 @@ pub fn run_repl(workdir string, vrepl_prefix string) []string {
println(version)
println('Use Ctrl-C or `exit` to exit')
file := os.join( workdir, '.${vrepl_prefix}vrepl.v' )
temp_file := os.join( workdir, '.${vrepl_prefix}vrepl_temp.v')
file := os.join_path(workdir, '.${vrepl_prefix}vrepl.v')
temp_file := os.join_path(workdir, '.${vrepl_prefix}vrepl_temp.v')
mut prompt := '>>> '
defer {
println('')

View File

@@ -52,7 +52,7 @@ fn v_test_compiler(vargs string) {
eprintln('')
building_examples_failed := testing.v_build_failing(vargs, 'examples')
eprintln('')
building_live_failed := testing.v_build_failing(vargs + '-live', os.join('examples','hot_reload'))
building_live_failed := testing.v_build_failing(vargs + '-live', os.join_path('examples', 'hot_reload'))
eprintln('')
v_module_install_cmd := '$vexe install nedpals.args'
eprintln('')