From 9c63cac54de7632e9cbdb9bf5c44a9cdab0f3868 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 16 Jul 2019 02:06:39 +0200 Subject: [PATCH] another Windows fix --- vlib/os/os.v | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vlib/os/os.v b/vlib/os/os.v index 827f2d725e..2796b6f44e 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -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 '.' }