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

os: fix realpath on windows

This commit is contained in:
Alexander Medvednikov 2019-11-23 20:56:22 +03:00
parent 1bd8c465d3
commit 0aa2196eec

View File

@ -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
}