compiler: better detection of module path supplied to `build module` command (#2305)
compiler: better detection of module path supplied to `build module` command (#2305)pull/2307/head
parent
5ef2c947f7
commit
342e6a14a2
|
@ -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")...')
|
||||
|
|
Loading…
Reference in New Issue