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

compiler: better detection of module path supplied to build module command (#2305)

compiler: better detection of module path supplied to `build module` command (#2305)
This commit is contained in:
joe-conigliaro 2019-10-12 20:48:57 +11:00 committed by GitHub
parent 5ef2c947f7
commit 342e6a14a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -827,7 +827,6 @@ fn new_v(args[]string) &V {
if dir.starts_with('.$os.PathSeparator') { if dir.starts_with('.$os.PathSeparator') {
dir = dir.right(2) dir = dir.right(2)
} }
adir := os.realpath(dir)
if args.len < 2 { if args.len < 2 {
dir = '' dir = ''
} }
@ -837,13 +836,16 @@ fn new_v(args[]string) &V {
if joined_args.contains('build module ') { if joined_args.contains('build module ') {
build_mode = .build_module build_mode = .build_module
// v build module ~/v/os => os.o // v build module ~/v/os => os.o
mod_path := if adir.contains('vlib') { mod_path := if dir.contains('vlib') {
adir.all_after('vlib'+os.PathSeparator) dir.all_after('vlib'+os.PathSeparator)
} }
else if adir.contains(os.PathSeparator) { else if dir.starts_with('.\\') || dir.starts_with('./') {
adir.all_after(os.PathSeparator) dir.right(2)
}
else if dir.starts_with(os.PathSeparator) {
dir.all_after(os.PathSeparator)
} else { } else {
adir dir
} }
mod = mod_path.replace(os.PathSeparator, '.') mod = mod_path.replace(os.PathSeparator, '.')
println('Building module "${mod}" (dir="$dir")...') println('Building module "${mod}" (dir="$dir")...')