Further fixes (stupid kdiff automerge)
This commit is contained in:
parent
c26e787e5d
commit
9de92522a6
2 changed files with 21 additions and 14 deletions
|
|
@ -970,7 +970,7 @@ proc moveFile*(source, dest: string) {.rtl, extern: "nos$1",
|
||||||
if crename(source, dest) != 0'i32:
|
if crename(source, dest) != 0'i32:
|
||||||
raise newException(EOS, $strerror(errno))
|
raise newException(EOS, $strerror(errno))
|
||||||
|
|
||||||
when not defined(ENOENT):
|
when not defined(ENOENT) and not defined(Windows):
|
||||||
var ENOENT {.importc, header: "<errno.h>".}: cint
|
var ENOENT {.importc, header: "<errno.h>".}: cint
|
||||||
|
|
||||||
when defined(Windows):
|
when defined(Windows):
|
||||||
|
|
@ -987,7 +987,6 @@ proc removeFile*(file: string) {.rtl, extern: "nos$1", tags: [FWriteDir].} =
|
||||||
## Removes the `file`. If this fails, `EOS` is raised. This does not fail
|
## Removes the `file`. If this fails, `EOS` is raised. This does not fail
|
||||||
## if the file never existed in the first place.
|
## if the file never existed in the first place.
|
||||||
## On Windows, ignores the read-only attribute.
|
## On Windows, ignores the read-only attribute.
|
||||||
if cremove(file) != 0'i32 and errno != ENOENT:
|
|
||||||
when defined(Windows):
|
when defined(Windows):
|
||||||
when useWinUnicode:
|
when useWinUnicode:
|
||||||
let f = newWideCString(file)
|
let f = newWideCString(file)
|
||||||
|
|
|
||||||
|
|
@ -553,18 +553,26 @@ const
|
||||||
|
|
||||||
FILE_FLAG_BACKUP_SEMANTICS* = 33554432'i32
|
FILE_FLAG_BACKUP_SEMANTICS* = 33554432'i32
|
||||||
|
|
||||||
|
# Error Constants
|
||||||
|
const
|
||||||
|
ERROR_ACCESS_DENIED* = 5
|
||||||
|
|
||||||
when useWinUnicode:
|
when useWinUnicode:
|
||||||
proc CreateFileW*(lpFileName: widecstring, dwDesiredAccess, dwShareMode: DWORD,
|
proc CreateFileW*(lpFileName: widecstring, dwDesiredAccess, dwShareMode: DWORD,
|
||||||
lpSecurityAttributes: pointer,
|
lpSecurityAttributes: pointer,
|
||||||
dwCreationDisposition, dwFlagsAndAttributes: DWORD,
|
dwCreationDisposition, dwFlagsAndAttributes: DWORD,
|
||||||
hTemplateFile: THANDLE): THANDLE {.
|
hTemplateFile: THANDLE): THANDLE {.
|
||||||
stdcall, dynlib: "kernel32", importc: "CreateFileW".}
|
stdcall, dynlib: "kernel32", importc: "CreateFileW".}
|
||||||
|
proc DeleteFileW*(pathName: widecstring): int32 {.
|
||||||
|
importc: "DeleteFileW", dynlib: "kernel32", stdcall.}
|
||||||
else:
|
else:
|
||||||
proc CreateFileA*(lpFileName: cstring, dwDesiredAccess, dwShareMode: DWORD,
|
proc CreateFileA*(lpFileName: cstring, dwDesiredAccess, dwShareMode: DWORD,
|
||||||
lpSecurityAttributes: pointer,
|
lpSecurityAttributes: pointer,
|
||||||
dwCreationDisposition, dwFlagsAndAttributes: DWORD,
|
dwCreationDisposition, dwFlagsAndAttributes: DWORD,
|
||||||
hTemplateFile: THANDLE): THANDLE {.
|
hTemplateFile: THANDLE): THANDLE {.
|
||||||
stdcall, dynlib: "kernel32", importc: "CreateFileA".}
|
stdcall, dynlib: "kernel32", importc: "CreateFileA".}
|
||||||
|
proc DeleteFileA*(pathName: cstring): int32 {.
|
||||||
|
importc: "DeleteFileA", dynlib: "kernel32", stdcall.}
|
||||||
|
|
||||||
proc SetEndOfFile*(hFile: THANDLE): WINBOOL {.stdcall, dynlib: "kernel32",
|
proc SetEndOfFile*(hFile: THANDLE): WINBOOL {.stdcall, dynlib: "kernel32",
|
||||||
importc: "SetEndOfFile".}
|
importc: "SetEndOfFile".}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue