mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-30 18:41:45 +00:00
replace doAssert false with raiseAssert in lib, which works better with strictdefs (#22458)
This commit is contained in:
@@ -60,7 +60,7 @@ proc nativeToUnixPath*(path: string): string =
|
||||
result[0] = '/'
|
||||
result[1] = path[0]
|
||||
if path.len > 2 and path[2] != '\\':
|
||||
doAssert false, "paths like `C:foo` are currently unsupported, path: " & path
|
||||
raiseAssert "paths like `C:foo` are currently unsupported, path: " & path
|
||||
when DirSep == '\\':
|
||||
result = replace(result, '\\', '/')
|
||||
|
||||
|
||||
@@ -396,7 +396,7 @@ proc moveFile*(source, dest: string) {.rtl, extern: "nos$1",
|
||||
|
||||
if not tryMoveFSObject(source, dest, isDir = false):
|
||||
when defined(windows):
|
||||
doAssert false
|
||||
raiseAssert "unreachable"
|
||||
else:
|
||||
# Fallback to copy & del
|
||||
copyFile(source, dest, {cfSymlinkAsIs})
|
||||
|
||||
@@ -259,7 +259,7 @@ proc isAbsolute*(path: string): bool {.rtl, noSideEffect, extern: "nos$1", raise
|
||||
# This works around the problem for posix, but Windows is still broken with nim js -d:nodejs
|
||||
result = path[0] == '/'
|
||||
else:
|
||||
doAssert false # if ever hits here, adapt as needed
|
||||
raiseAssert "unreachable" # if ever hits here, adapt as needed
|
||||
|
||||
when FileSystemCaseSensitive:
|
||||
template `!=?`(a, b: char): bool = a != b
|
||||
@@ -859,7 +859,7 @@ when not defined(nimscript):
|
||||
{.emit: "`ret` = process.cwd();".}
|
||||
return $ret
|
||||
elif defined(js):
|
||||
doAssert false, "use -d:nodejs to have `getCurrentDir` defined"
|
||||
raiseAssert "use -d:nodejs to have `getCurrentDir` defined"
|
||||
elif defined(windows):
|
||||
var bufsize = MAX_PATH.int32
|
||||
var res = newWideCString("", bufsize)
|
||||
|
||||
Reference in New Issue
Block a user