os: use unlink() to remove file (#9220)
removeFile() behavior should now be consistant between Windows and POSIX Fixes #9200
This commit is contained in:
parent
c0266e1afa
commit
dad290accb
2 changed files with 10 additions and 3 deletions
|
|
@ -33,8 +33,6 @@ else:
|
|||
import ospaths
|
||||
export ospaths
|
||||
|
||||
proc c_remove(filename: cstring): cint {.
|
||||
importc: "remove", header: "<stdio.h>".}
|
||||
proc c_rename(oldname, newname: cstring): cint {.
|
||||
importc: "rename", header: "<stdio.h>".}
|
||||
proc c_system(cmd: cstring): cint {.
|
||||
|
|
@ -652,7 +650,7 @@ proc tryRemoveFile*(file: string): bool {.rtl, extern: "nos$1", tags: [WriteDirE
|
|||
deleteFile(f) != 0:
|
||||
result = true
|
||||
else:
|
||||
if c_remove(file) != 0'i32 and errno != ENOENT:
|
||||
if unlink(file) != 0'i32 and errno != ENOENT:
|
||||
result = false
|
||||
|
||||
proc removeFile*(file: string) {.rtl, extern: "nos$1", tags: [WriteDirEffect].} =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue