remove decades-deprecated Win32 API *A function support (#21315)
This commit is contained in:
parent
9b5ae2b2eb
commit
612abda4f4
13 changed files with 173 additions and 414 deletions
|
|
@ -48,14 +48,10 @@ proc createSymlink*(src, dest: string) {.noWeirdTarget.} =
|
|||
const SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE = 2
|
||||
# allows anyone with developer mode on to create a link
|
||||
let flag = dirExists(src).int32 or SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
|
||||
when useWinUnicode:
|
||||
var wSrc = newWideCString(src)
|
||||
var wDst = newWideCString(dest)
|
||||
if createSymbolicLinkW(wDst, wSrc, flag) == 0 or getLastError() != 0:
|
||||
raiseOSError(osLastError(), $(src, dest))
|
||||
else:
|
||||
if createSymbolicLinkA(dest, src, flag) == 0 or getLastError() != 0:
|
||||
raiseOSError(osLastError(), $(src, dest))
|
||||
var wSrc = newWideCString(src)
|
||||
var wDst = newWideCString(dest)
|
||||
if createSymbolicLinkW(wDst, wSrc, flag) == 0 or getLastError() != 0:
|
||||
raiseOSError(osLastError(), $(src, dest))
|
||||
else:
|
||||
if symlink(src, dest) != 0:
|
||||
raiseOSError(osLastError(), $(src, dest))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue