diff --git a/vlib/os/os.v b/vlib/os/os.v index f307a37031..21e2035855 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -869,9 +869,11 @@ pub fn realpath(fpath string) string { mut fullpath := calloc( MAX_PATH ) mut res := 0 $if windows { - // here we want an int==0 if _fullpath failed , in which case - // it would return NULL, and !isnil(NULL) would be false==0 - res = int( !isnil(C._fullpath( fullpath, fpath.str, MAX_PATH )) ) + ret := C._fullpath(fpath.str, fullpath) + if ret == 0 { + return fpath + } + return string(fullpath) } $else{ ret := C.realpath(fpath.str, fullpath) @@ -880,9 +882,6 @@ pub fn realpath(fpath string) string { } return string(fullpath) } - if res != 0 { - return string(fullpath, vstrlen(fullpath)) - } return fpath }