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

os: fix truncate() on windows (#18262)

This commit is contained in:
yuyi
2023-05-25 19:37:53 +08:00
committed by GitHub
parent bc88183318
commit caee3935a5
3 changed files with 14 additions and 7 deletions

View File

@ -101,11 +101,10 @@ pub fn open_file(path string, mode string, options ...int) !File {
}
}
p := fix_windows_path(path)
mut fd := 0
$if windows {
fd = C._wopen(p.to_wide(), flags, permission)
fd := $if windows {
C._wopen(p.to_wide(), flags, permission)
} $else {
fd = C.open(&char(p.str), flags, permission)
C.open(&char(p.str), flags, permission)
}
if fd == -1 {
return error(posix_get_error_msg(C.errno))