@@ -29,7 +29,7 @@ fn C.CopyFile(&u16, &u16, bool) int
29
29
30
30
// fn C.lstat(charptr, voidptr) u64
31
31
32
- fn C._wstat64 (& char , voidptr ) u64
32
+ fn C._wstat64 (& u16 , voidptr ) u64
33
33
34
34
fn C.chown (& char, int , int ) int
35
35
@@ -168,7 +168,7 @@ pub fn file_size(path string) u64 {
168
168
$if x64 {
169
169
$if windows {
170
170
mut swin := C.__stat64 {}
171
- if C._wstat64 (& char ( path.to_wide () ), voidptr (& swin)) != 0 {
171
+ if C._wstat64 (path.to_wide (), voidptr (& swin)) != 0 {
172
172
eprintln_unknown_file_size ()
173
173
return 0
174
174
}
@@ -471,7 +471,7 @@ pub fn rm(path string) ? {
471
471
// rmdir removes a specified directory.
472
472
pub fn rmdir (path string ) ? {
473
473
$if windows {
474
- rc := C.RemoveDirectory (& char ( path.to_wide () ))
474
+ rc := C.RemoveDirectory (path.to_wide ())
475
475
if rc == 0 {
476
476
// https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-removedirectorya - 0 is failure
477
477
return error ('Failed to remove "$path ": ' + posix_get_error_msg (C.errno))
@@ -777,12 +777,11 @@ pub fn getwd() string {
777
777
// NB: this particular rabbit hole is *deep* ...
778
778
[manualfree ]
779
779
pub fn real_path (fpath string ) string {
780
- mut fullpath := & byte (0 )
781
780
mut res := ''
782
781
$if windows {
783
782
// GetFullPathName doesn't work with symbolic links,
784
783
// so if it is not a file, get full path
785
- fullpath = unsafe { & u16 (vcalloc_noscan (max_path_len * 2 )) }
784
+ mut fullpath : = unsafe { & u16 (vcalloc_noscan (max_path_len * 2 )) }
786
785
// TODO: check errors if path len is not enough
787
786
ret := C.GetFullPathName (fpath.to_wide (), max_path_len, fullpath, 0 )
788
787
if ret == 0 {
@@ -791,7 +790,7 @@ pub fn real_path(fpath string) string {
791
790
}
792
791
res = unsafe { string_from_wide (fullpath) }
793
792
} $else {
794
- fullpath = vcalloc_noscan (max_path_len)
793
+ mut fullpath : = vcalloc_noscan (max_path_len)
795
794
ret := & char (C.realpath (& char (fpath.str), & char (fullpath)))
796
795
if ret == 0 {
797
796
unsafe { free (fullpath) }
0 commit comments