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

os: let os.dir("/xyz") return "/" (fixes compiling .v files in /)

This commit is contained in:
Delyan Angelov
2021-07-30 03:14:09 +03:00
parent 7c504920e1
commit 44892fd942
2 changed files with 5 additions and 0 deletions

View File

@@ -170,6 +170,9 @@ pub fn dir(path string) string {
return '.'
}
pos := path.last_index(path_separator) or { return '.' }
if pos == 0 && path_separator == '/' {
return '/'
}
return path[..pos]
}