parent
da575bec54
commit
6a1b8e691f
5 changed files with 14 additions and 9 deletions
|
|
@ -43,6 +43,7 @@ proc setupVM*(module: PSym; scriptName: string): PEvalContext =
|
||||||
template cbos(name, body) {.dirty.} =
|
template cbos(name, body) {.dirty.} =
|
||||||
result.registerCallback "stdlib.system." & astToStr(name),
|
result.registerCallback "stdlib.system." & astToStr(name),
|
||||||
proc (a: VmArgs) =
|
proc (a: VmArgs) =
|
||||||
|
errorMsg = nil
|
||||||
try:
|
try:
|
||||||
body
|
body
|
||||||
except OSError:
|
except OSError:
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,8 @@ mkDir "bin/nimblepkg"
|
||||||
for file in listFiles("nimble" & $id & "/src/nimblepkg/"):
|
for file in listFiles("nimble" & $id & "/src/nimblepkg/"):
|
||||||
cpFile file, "bin/nimblepkg/" & file.extractFilename
|
cpFile file, "bin/nimblepkg/" & file.extractFilename
|
||||||
|
|
||||||
mvFile "nimble" & $id & "/src/nimble".toExe, "bin/nimble".toExe
|
try:
|
||||||
|
mvFile "nimble" & $id & "/src/nimble".toExe, "bin/nimble".toExe
|
||||||
|
except OSError:
|
||||||
|
cpFile "nimble" & $id & "/src/nimble".toExe, "bin/nimble".toExe
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -580,9 +580,9 @@ proc moveFile*(source, dest: string) {.rtl, extern: "nos$1",
|
||||||
when useWinUnicode:
|
when useWinUnicode:
|
||||||
let s = newWideCString(source)
|
let s = newWideCString(source)
|
||||||
let d = newWideCString(dest)
|
let d = newWideCString(dest)
|
||||||
if moveFileW(s, d, 0'i32) == 0'i32: raiseOSError(osLastError())
|
if moveFileW(s, d) == 0'i32: raiseOSError(osLastError())
|
||||||
else:
|
else:
|
||||||
if moveFileA(source, dest, 0'i32) == 0'i32: raiseOSError(osLastError())
|
if moveFileA(source, dest) == 0'i32: raiseOSError(osLastError())
|
||||||
else:
|
else:
|
||||||
if c_rename(source, dest) != 0'i32:
|
if c_rename(source, dest) != 0'i32:
|
||||||
raiseOSError(osLastError(), $strerror(errno))
|
raiseOSError(osLastError(), $strerror(errno))
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,8 @@ template gcAssert(cond: bool, msg: string) =
|
||||||
echo "[GCASSERT] ", msg
|
echo "[GCASSERT] ", msg
|
||||||
GC_disable()
|
GC_disable()
|
||||||
writeStackTrace()
|
writeStackTrace()
|
||||||
|
#var x: ptr int
|
||||||
|
#echo x[]
|
||||||
quit 1
|
quit 1
|
||||||
|
|
||||||
proc addZCT(s: var CellSeq, c: PCell) {.noinline.} =
|
proc addZCT(s: var CellSeq, c: PCell) {.noinline.} =
|
||||||
|
|
|
||||||
|
|
@ -337,11 +337,10 @@ when useWinUnicode:
|
||||||
stdcall, dynlib: "kernel32", importc: "SetFileAttributesW".}
|
stdcall, dynlib: "kernel32", importc: "SetFileAttributesW".}
|
||||||
|
|
||||||
proc copyFileW*(lpExistingFileName, lpNewFileName: WideCString,
|
proc copyFileW*(lpExistingFileName, lpNewFileName: WideCString,
|
||||||
bFailIfExists: cint): cint {.
|
bFailIfExists: WINBOOL): WINBOOL {.
|
||||||
importc: "CopyFileW", stdcall, dynlib: "kernel32".}
|
importc: "CopyFileW", stdcall, dynlib: "kernel32".}
|
||||||
|
|
||||||
proc moveFileW*(lpExistingFileName, lpNewFileName: WideCString,
|
proc moveFileW*(lpExistingFileName, lpNewFileName: WideCString): WINBOOL {.
|
||||||
bFailIfExists: cint): cint {.
|
|
||||||
importc: "MoveFileW", stdcall, dynlib: "kernel32".}
|
importc: "MoveFileW", stdcall, dynlib: "kernel32".}
|
||||||
|
|
||||||
proc getEnvironmentStringsW*(): WideCString {.
|
proc getEnvironmentStringsW*(): WideCString {.
|
||||||
|
|
@ -368,8 +367,7 @@ else:
|
||||||
bFailIfExists: cint): cint {.
|
bFailIfExists: cint): cint {.
|
||||||
importc: "CopyFileA", stdcall, dynlib: "kernel32".}
|
importc: "CopyFileA", stdcall, dynlib: "kernel32".}
|
||||||
|
|
||||||
proc moveFileA*(lpExistingFileName, lpNewFileName: cstring,
|
proc moveFileA*(lpExistingFileName, lpNewFileName: cstring): WINBOOL {.
|
||||||
bFailIfExists: cint): cint {.
|
|
||||||
importc: "MoveFileA", stdcall, dynlib: "kernel32".}
|
importc: "MoveFileA", stdcall, dynlib: "kernel32".}
|
||||||
|
|
||||||
proc getEnvironmentStringsA*(): cstring {.
|
proc getEnvironmentStringsA*(): cstring {.
|
||||||
|
|
@ -1035,4 +1033,4 @@ when defined(useWinAnsi):
|
||||||
else:
|
else:
|
||||||
proc readConsoleInput*(hConsoleInput: Handle, lpBuffer: pointer, nLength: cint,
|
proc readConsoleInput*(hConsoleInput: Handle, lpBuffer: pointer, nLength: cint,
|
||||||
lpNumberOfEventsRead: ptr cint): cint
|
lpNumberOfEventsRead: ptr cint): cint
|
||||||
{.stdcall, dynlib: "kernel32", importc: "ReadConsoleInputW".}
|
{.stdcall, dynlib: "kernel32", importc: "ReadConsoleInputW".}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue