another Windows fix

pull/1170/head
Alexander Medvednikov 2019-07-16 02:06:39 +02:00
parent 090cdcf3b9
commit 9c63cac54d
1 changed files with 9 additions and 1 deletions

View File

@ -385,7 +385,15 @@ pub fn ext(path string) string {
// dir returns all but the last element of path, typically the path's directory.
pub fn dir(path string) string {
pos := path.last_index(PathSeparator)
mut pos := -1
// TODO PathSeparator defined in os_win.v doesn't work when building V,
// because v.c is generated for a nix system.
$if windows {
pos = path.last_index('\\')
}
$else {
pos = path.last_index(PathSeparator)
}
if pos == -1 {
return '.'
}