diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index 69bf0f8387..814f8e4f6a 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -309,7 +309,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr { } else { fname.replace('.v', '') } - generated_binary_fpath := os.join_path(tmpd, generated_binary_fname) + generated_binary_fpath := os.join_path_single(tmpd, generated_binary_fname) if os.exists(generated_binary_fpath) { if ts.rm_binaries { os.rm(generated_binary_fpath) or {} @@ -406,7 +406,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr { } pub fn vlib_should_be_present(parent_dir string) { - vlib_dir := os.join_path(parent_dir, 'vlib') + vlib_dir := os.join_path_single(parent_dir, 'vlib') if !os.is_dir(vlib_dir) { eprintln('$vlib_dir is missing, it must be next to the V executable') exit(1) @@ -427,7 +427,7 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main eprintln('v compiler args: "$vargs"') } mut session := new_test_session(vargs, true) - files := os.walk_ext(os.join_path(parent_dir, folder), '.v') + files := os.walk_ext(os.join_path_single(parent_dir, folder), '.v') mut mains := []string{} mut skipped := oskipped.clone() next_file: for f in files { @@ -451,7 +451,7 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main maxc := if c.len > 300 { 300 } else { c.len } start := c[0..maxc] if start.contains('module ') && !start.contains('module main') { - skipped_f := f.replace(os.join_path(parent_dir, ''), '') + skipped_f := f.replace(os.join_path_single(parent_dir, ''), '') skipped << skipped_f } for skip_prefix in oskipped { diff --git a/cmd/tools/modules/vgit/vgit.v b/cmd/tools/modules/vgit/vgit.v index e4e158d21f..2a935dea10 100644 --- a/cmd/tools/modules/vgit/vgit.v +++ b/cmd/tools/modules/vgit/vgit.v @@ -76,7 +76,7 @@ pub fn prepare_vc_source(vcdir string, cdir string, commit string) (string, stri 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_path(local_worktree_path, '.git')) { + if os.is_dir(local_worktree_path) && os.is_dir(os.join_path_single(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 ') @@ -107,7 +107,7 @@ pub mut: pub fn (mut vgit_context VGitContext) compile_oldv_if_needed() { vgit_context.vexename = if os.user_os() == 'windows' { 'v.exe' } else { 'v' } - vgit_context.vexepath = os.real_path(os.join_path(vgit_context.path_v, vgit_context.vexename)) + vgit_context.vexepath = os.real_path(os.join_path_single(vgit_context.path_v, vgit_context.vexename)) mut command_for_building_v_from_c_source := '' mut command_for_selfbuilding := '' if 'windows' == os.user_os() { diff --git a/vlib/v/parser/comptime.v b/vlib/v/parser/comptime.v index 184442e8dd..af2659fc9f 100644 --- a/vlib/v/parser/comptime.v +++ b/vlib/v/parser/comptime.v @@ -110,7 +110,7 @@ fn (mut p Parser) comptime_call() ast.ComptimeCall { // check absolute path first if !os.exists(abs_path) { // ... look relative to the source file: - epath = os.real_path(os.join_path(os.dir(p.file_name), epath)) + epath = os.real_path(os.join_path_single(os.dir(p.file_name), epath)) if !os.exists(epath) { p.error_with_pos('"$epath" does not exist so it cannot be embedded', spos) @@ -144,11 +144,11 @@ fn (mut p Parser) comptime_call() ast.ComptimeCall { tmpl_path := if is_html { '${fn_path.last()}.html' } else { path_of_literal_string_param } // Looking next to the vweb program dir := os.dir(compiled_vfile_path) - mut path := os.join_path(dir, fn_path_joined) + mut path := os.join_path_single(dir, fn_path_joined) path += '.html' path = os.real_path(path) if !is_html { - path = os.join_path(dir, tmpl_path) + path = os.join_path_single(dir, tmpl_path) } if !os.exists(path) { if is_html { diff --git a/vlib/v/parser/tmpl.v b/vlib/v/parser/tmpl.v index 8bb8cda75f..ed608d94e0 100644 --- a/vlib/v/parser/tmpl.v +++ b/vlib/v/parser/tmpl.v @@ -135,7 +135,7 @@ mut sb := strings.new_builder($lstartlength)\n // an absolute path templates_folder = '' } - file_path := os.real_path(os.join_path(templates_folder, '$file_name$file_ext')) + file_path := os.real_path(os.join_path_single(templates_folder, '$file_name$file_ext')) $if trace_tmpl ? { eprintln('>>> basepath: "$basepath" , template_file: "$template_file" , fn_name: "$fn_name" , @include line: "$line" , file_name: "$file_name" , file_ext: "$file_ext" , templates_folder: "$templates_folder" , file_path: "$file_path"') } diff --git a/vlib/v/util/diff/diff.v b/vlib/v/util/diff/diff.v index 490342a07c..4a0b6e437c 100644 --- a/vlib/v/util/diff/diff.v +++ b/vlib/v/util/diff/diff.v @@ -72,11 +72,11 @@ pub fn color_compare_files(diff_cmd string, file1 string, file2 string) string { } pub fn color_compare_strings(diff_cmd string, unique_prefix string, expected string, found string) string { - cdir := os.join_path(os.cache_dir(), unique_prefix) + cdir := os.join_path_single(os.cache_dir(), unique_prefix) os.mkdir(cdir) or {} ctime := time.sys_mono_now() - e_file := os.join_path(cdir, '${ctime}.expected.txt') - f_file := os.join_path(cdir, '${ctime}.found.txt') + e_file := os.join_path_single(cdir, '${ctime}.expected.txt') + f_file := os.join_path_single(cdir, '${ctime}.found.txt') os.write_file(e_file, expected) or { panic(err) } os.write_file(f_file, found) or { panic(err) } res := color_compare_files(diff_cmd, e_file, f_file) diff --git a/vlib/v/util/module.v b/vlib/v/util/module.v index 60ed83faa0..e4832fcd01 100644 --- a/vlib/v/util/module.v +++ b/vlib/v/util/module.v @@ -13,7 +13,7 @@ pub fn qualify_import(pref &pref.Preferences, mod string, file_path string) stri mod_paths << os.vmodules_paths() mod_path := mod.replace('.', os.path_separator) for search_path in mod_paths { - try_path := os.join_path(search_path, mod_path) + try_path := os.join_path_single(search_path, mod_path) if os.is_dir(try_path) { if m1 := mod_path_to_full_name(pref, mod, try_path) { trace_mod_path_to_full_name(@LINE, mod, try_path, m1) @@ -70,7 +70,7 @@ pub fn mod_path_to_full_name(pref &pref.Preferences, mod string, path string) ?s mod_path := mod.replace('.', os.path_separator) // go back through each parent in path_parts and join with `mod_path` to see the dir exists for i := path_parts.len - 1; i > 0; i-- { - try_path := os.join_path(path_parts[0..i].join(os.path_separator), mod_path) + try_path := os.join_path_single(path_parts[0..i].join(os.path_separator), mod_path) // found module path if os.is_dir(try_path) { // we know we are in one of the `vmod_folders` diff --git a/vlib/v/util/recompilation/recompilation.v b/vlib/v/util/recompilation/recompilation.v index 10892cae5d..1a4564c860 100644 --- a/vlib/v/util/recompilation/recompilation.v +++ b/vlib/v/util/recompilation/recompilation.v @@ -9,7 +9,7 @@ import os // V from source. pub fn disabling_file(vroot string) string { tools_folder := os.join_path(vroot, 'cmd', 'tools') - res := os.join_path(tools_folder, '.disable_autorecompilation') + res := os.join_path_single(tools_folder, '.disable_autorecompilation') return res } diff --git a/vlib/v/util/util.v b/vlib/v/util/util.v index 65d7e21dc9..89f766b366 100644 --- a/vlib/v/util/util.v +++ b/vlib/v/util/util.v @@ -46,7 +46,7 @@ pub fn set_vroot_folder(vroot_path string) { // VEXE env variable is needed so that compiler.vexe_path() // can return it later to whoever needs it: vname := if os.user_os() == 'windows' { 'v.exe' } else { 'v' } - os.setenv('VEXE', os.real_path(os.join_path(vroot_path, vname)), true) + os.setenv('VEXE', os.real_path(os.join_path_single(vroot_path, vname)), true) os.setenv('VCHILD', 'true', true) } @@ -121,11 +121,11 @@ pub fn launch_tool(is_verbose bool, tool_name string, args []string) { set_vroot_folder(vroot) tool_args := args_quote_paths(args) tools_folder := os.join_path(vroot, 'cmd', 'tools') - tool_basename := os.real_path(os.join_path(tools_folder, tool_name)) + tool_basename := os.real_path(os.join_path_single(tools_folder, tool_name)) mut tool_exe := '' mut tool_source := '' if os.is_dir(tool_basename) { - tool_exe = path_of_executable(os.join_path(tool_basename, tool_name)) + tool_exe = path_of_executable(os.join_path_single(tool_basename, tool_name)) tool_source = tool_basename } else { tool_exe = path_of_executable(tool_basename) @@ -240,7 +240,7 @@ pub fn should_recompile_tool(vexe string, tool_source string, tool_name string, fn tool_source2name_and_exe(tool_source string) (string, string) { sfolder := os.dir(tool_source) tool_name := os.base(tool_source).replace('.v', '') - tool_exe := os.join_path(sfolder, path_of_executable(tool_name)) + tool_exe := os.join_path_single(sfolder, path_of_executable(tool_name)) return tool_name, tool_exe } @@ -357,8 +357,8 @@ fn non_empty(arg []string) []string { } pub fn check_module_is_installed(modulename string, is_verbose bool) ?bool { - mpath := os.join_path(os.vmodules_dir(), modulename) - mod_v_file := os.join_path(mpath, 'v.mod') + mpath := os.join_path_single(os.vmodules_dir(), modulename) + mod_v_file := os.join_path_single(mpath, 'v.mod') murl := 'https://github.com/vlang/$modulename' if is_verbose { eprintln('check_module_is_installed: mpath: $mpath') @@ -484,7 +484,7 @@ pub fn get_vtmp_folder() string { return vtmp } uid := os.getuid() - vtmp = os.join_path(os.temp_dir(), 'v_$uid') + vtmp = os.join_path_single(os.temp_dir(), 'v_$uid') if !os.exists(vtmp) || !os.is_dir(vtmp) { os.mkdir_all(vtmp) or { panic(err) } } diff --git a/vlib/v/util/vtest/vtest.v b/vlib/v/util/vtest/vtest.v index 948cf411d0..e89b57bcf3 100644 --- a/vlib/v/util/vtest/vtest.v +++ b/vlib/v/util/vtest/vtest.v @@ -14,7 +14,7 @@ pub fn filter_vtest_only(paths []string, config FilterVTestConfig) []string { for relative_path in paths { mut file := relative_path if config.basepath.len > 0 { - file = os.join_path(config.basepath, file) + file = os.join_path_single(config.basepath, file) } if config.fix_slashes { file = file.replace('\\', '/')