From 342e6a14a21f44c61d3b40965455a6227535b62c Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Sat, 12 Oct 2019 20:48:57 +1100 Subject: [PATCH] compiler: better detection of module path supplied to `build module` command (#2305) compiler: better detection of module path supplied to `build module` command (#2305) --- compiler/main.v | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/compiler/main.v b/compiler/main.v index 4db131aa69..cb3fe32def 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -827,7 +827,6 @@ fn new_v(args[]string) &V { if dir.starts_with('.$os.PathSeparator') { dir = dir.right(2) } - adir := os.realpath(dir) if args.len < 2 { dir = '' } @@ -837,13 +836,16 @@ fn new_v(args[]string) &V { if joined_args.contains('build module ') { build_mode = .build_module // v build module ~/v/os => os.o - mod_path := if adir.contains('vlib') { - adir.all_after('vlib'+os.PathSeparator) + mod_path := if dir.contains('vlib') { + dir.all_after('vlib'+os.PathSeparator) } - else if adir.contains(os.PathSeparator) { - adir.all_after(os.PathSeparator) + else if dir.starts_with('.\\') || dir.starts_with('./') { + dir.right(2) + } + else if dir.starts_with(os.PathSeparator) { + dir.all_after(os.PathSeparator) } else { - adir + dir } mod = mod_path.replace(os.PathSeparator, '.') println('Building module "${mod}" (dir="$dir")...')