I'm getting "Access is denied" exception on a copyFile command on Windows. I'm not really sure why. existsFile for the file returns true as does existsDir for the dir and I'm using the proper syntax of copyFile(source, dest). There's no other file in dest.
echo file
echo mDir
C:\Users\andys-pc\Downloads\test.filename
E:\
getFileInfo results:
file: (id: (device: -1674769420, file: 745565), kind: pcFile, size: 154080124, permissions: {fpUserExec, fpUserWrite, fpUserRead, fpGroupExec, fpGroupWrite, fpGroupRead, fpOthersExec, fpOthersWrite, fpOthersRead}, linkCount: 1, lastAccessTime: (seconds: 1588006750, nanosecond: 523462900), lastWriteTime: (seconds: 1578638167, nanosecond: 205297700), creationTime: (seconds: 1588006068, nanosecond: 448599000))
dir: (id: (device: 34148618, file: 45815), kind: pcDir, size: 0, permissions: {fpUserExec, fpUserWrite, fpUserRead, fpGroupExec, fpGroupWrite, fpGroupRead, fpOthersExec, fpOthersWrite, fpOthersRead}, linkCount: 1, lastAccessTime: (seconds: 1588183553, nanosecond: 99567400), lastWriteTime: (seconds: 1588006752, nanosecond: 495716200), creationTime: (seconds: 1584007620, nanosecond: 166189600))
It seems I have full permissions here. Same error with moveFile. Am I missing something? Version 1.2.0
Got ref 00000000007D2240 --> [errorCode = 5,
parent = nil,
name = 0000000000530BCE"OSError",
msg = 0000000000819058"Access is denied.\13\10"
"Additional info: \"(\\\"C:\\\\\\\\Users\\\\\\\\andys-pc\\\\\\\\Downloads\\\\\\\\test.filename\\\", \\\"E:\\\\\\\\")\"",
trace = 00000000007FA048@[[procname = 000000000053DFAE"main",
line = 158,
filename = 000000000053D0B0"C:\\Users\\andys-pc\\GitHub\\Proj\\src\\main.nim"], [procname = 0000000000536669"mainLoop",
line = 291,
filename = 00000000005363C0"C:\\Users\\andys-pc\\.nimble\\pkgs\\wnim-0.11.0\\wNim\\private\\wApp.nim"], [procname = 00000000005365C5"messageLoop",
line = 260,
filename = 00000000005363C0"C:\\Users\\andys-pc\\.nimble\\pkgs\\wnim-0.11.0\\wNim\\private\\wApp.nim"], [procname = 0000000000536570"wAppProcessDialogMessage",
line = 213,
filename = 00000000005363C0"C:\\Users\\andys-pc\\.nimble\\pkgs\\wnim-0.11.0\\wNim\\private\\wApp.nim"], [procname = 0000000000539F51":anonymous",
line = 1846,
filename = 0000000000539398"C:\\Users\\andys-pc\\.nimble\\pkgs\\wnim-0.11.0\\wNim\\private\\wWindow.nim"], [procname = 00000000005398EA"processEvent",
line = 1252,
filename = 0000000000539398"C:\\Users\\andys-pc\\.nimble\\pkgs\\wnim-0.11.0\\wNim\\private\\wWindow.nim"], [procname = 00000000005398DE"callHandler",
line = 1222,
filename = 0000000000539398"C:\\Users\\andys-pc\\.nimble\\pkgs\\wnim-0.11.0\\wNim\\private\\wWindow.nim"], [procname = 000000000053D0A3":anonymous",
line = 138,
filename = 000000000053D0B0"C:\\Users\\andys-pc\\GitHub\\Proj\\src\\main.nim"], [procname = 000000000053D219"handleFiles",
line = 114,
filename = 000000000053D0B0"C:\\Users\\andys-pc\\GitHub\\Proj\\src\\main.nim"], [procname = 000000000053193E"copyFiles",
line = 104,
filename = 0000000000531948"C:\\Users\\andys-pc\\GitHub\\Proj\\src\\gamepath.nim"], [procname = 0000000000530BEF"copyFile",
line = 1676,
filename = 0000000000530938"C:\\Users\\andys-pc\\.choosenim\\toolchains\\nim-1.2.0\\lib\\pure\\os.nim"], [procname = 0000000000530BD6"raiseOSError",
line = 94,
filename = 0000000000530A40"C:\\Users\\andys-pc\\.choosenim\\toolchains\\nim-1.2.0\\lib\\pure\\includes\\oserr.nim"]],
up = nil]
,Access is denied.
copyFile("C:\Users\andys-pc\Downloads\test.filename","E:\TEST.FILENAME")
Yup, that's it. Nim doesn't fallback to the default filename if not specified like cp or other languages. Thanks