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

os: use path separator more consistently

This commit is contained in:
Delyan Angelov 2019-09-11 01:08:23 +03:00 committed by Alexander Medvednikov
parent 08262b5c43
commit a53c69de38
2 changed files with 8 additions and 5 deletions

View File

@ -790,6 +790,9 @@ fn new_v(args[]string) &V {
} }
} }
rdir := os.realpath( dir )
rdir_name := os.filename( rdir )
obfuscate := args.contains('-obf') obfuscate := args.contains('-obf')
is_repl:=args.contains('-repl') is_repl:=args.contains('-repl')
pref := &Preferences { pref := &Preferences {
@ -812,7 +815,7 @@ fn new_v(args[]string) &V {
build_mode: build_mode build_mode: build_mode
cflags: cflags cflags: cflags
ccompiler: find_c_compiler() ccompiler: find_c_compiler()
building_v: !is_repl && (dir == 'compiler' || building_v: !is_repl && (rdir_name == 'compiler' ||
dir.contains('v/vlib')) dir.contains('v/vlib'))
} }
if pref.is_verbose || pref.is_debug { if pref.is_verbose || pref.is_debug {

View File

@ -466,7 +466,7 @@ fn path_sans_ext(path string) string {
pub fn basedir(path string) string { pub fn basedir(path string) string {
pos := path.last_index('/') pos := path.last_index(PathSeparator)
if pos == -1 { if pos == -1 {
return path return path
} }
@ -474,7 +474,7 @@ pub fn basedir(path string) string {
} }
pub fn filename(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 // get_line returns a one-line string from stdin
@ -582,7 +582,7 @@ pub fn home_dir() string {
} }
home += homepath home += homepath
} }
home += '/' home += PathSeparator
return home return home
} }
@ -746,7 +746,7 @@ pub fn walk_ext(path, ext string) []string {
if file.starts_with('.') { if file.starts_with('.') {
continue continue
} }
p := path + '/' + file p := path + PathSeparator + file
if os.is_dir(p) { if os.is_dir(p) {
res << walk_ext(p, ext) res << walk_ext(p, ext)
} }