diff --git a/compiler/main.v b/compiler/main.v index b507be1935..bb6972f997 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -790,6 +790,9 @@ fn new_v(args[]string) &V { } } + rdir := os.realpath( dir ) + rdir_name := os.filename( rdir ) + obfuscate := args.contains('-obf') is_repl:=args.contains('-repl') pref := &Preferences { @@ -812,7 +815,7 @@ fn new_v(args[]string) &V { build_mode: build_mode cflags: cflags ccompiler: find_c_compiler() - building_v: !is_repl && (dir == 'compiler' || + building_v: !is_repl && (rdir_name == 'compiler' || dir.contains('v/vlib')) } if pref.is_verbose || pref.is_debug { diff --git a/vlib/os/os.v b/vlib/os/os.v index 1087dbc21c..05795bca3b 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -466,7 +466,7 @@ fn path_sans_ext(path string) string { pub fn basedir(path string) string { - pos := path.last_index('/') + pos := path.last_index(PathSeparator) if pos == -1 { return path } @@ -474,7 +474,7 @@ pub fn basedir(path string) string { } pub fn filename(path string) string { - return path.all_after('/') + return path.all_after(PathSeparator) } // get_line returns a one-line string from stdin @@ -582,7 +582,7 @@ pub fn home_dir() string { } home += homepath } - home += '/' + home += PathSeparator return home } @@ -746,7 +746,7 @@ pub fn walk_ext(path, ext string) []string { if file.starts_with('.') { continue } - p := path + '/' + file + p := path + PathSeparator + file if os.is_dir(p) { res << walk_ext(p, ext) }