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:
parent
1bd8c465d3
commit
0aa2196eec
11
vlib/os/os.v
11
vlib/os/os.v
@ -869,9 +869,11 @@ pub fn realpath(fpath string) string {
|
|||||||
mut fullpath := calloc( MAX_PATH )
|
mut fullpath := calloc( MAX_PATH )
|
||||||
mut res := 0
|
mut res := 0
|
||||||
$if windows {
|
$if windows {
|
||||||
// here we want an int==0 if _fullpath failed , in which case
|
ret := C._fullpath(fpath.str, fullpath)
|
||||||
// it would return NULL, and !isnil(NULL) would be false==0
|
if ret == 0 {
|
||||||
res = int( !isnil(C._fullpath( fullpath, fpath.str, MAX_PATH )) )
|
return fpath
|
||||||
|
}
|
||||||
|
return string(fullpath)
|
||||||
}
|
}
|
||||||
$else{
|
$else{
|
||||||
ret := C.realpath(fpath.str, fullpath)
|
ret := C.realpath(fpath.str, fullpath)
|
||||||
@ -880,9 +882,6 @@ pub fn realpath(fpath string) string {
|
|||||||
}
|
}
|
||||||
return string(fullpath)
|
return string(fullpath)
|
||||||
}
|
}
|
||||||
if res != 0 {
|
|
||||||
return string(fullpath, vstrlen(fullpath))
|
|
||||||
}
|
|
||||||
return fpath
|
return fpath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user