{.deprecated: [existsFile: fileExists].} (#14735)
* {.deprecated: [existsFile: fileExists].}
* s/existsFile/fileExists/ except under deps
* workaround pending #14819
* fix test
This commit is contained in:
parent
366b9a7e4a
commit
dc5a40f3f3
31 changed files with 66 additions and 67 deletions
|
|
@ -51,7 +51,7 @@ template withDir*(dir: string; body: stmt): stmt =
|
|||
cd(curDir)
|
||||
|
||||
when true:
|
||||
if not existsFile("nakefile.nim"):
|
||||
if not fileExists("nakefile.nim"):
|
||||
echo "No nakefile.nim found. Current working dir is ", getCurrentDir()
|
||||
quit 1
|
||||
var args = ""
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ when true:
|
|||
of cmdShortOption, cmdLongOption:
|
||||
case key
|
||||
of "f", "file":
|
||||
if existsFile(val):
|
||||
if fileExists(val):
|
||||
zoneCfgFile = val
|
||||
else:
|
||||
echo("File does not exist: ", val)
|
||||
|
|
@ -136,7 +136,7 @@ when true:
|
|||
address.port = port
|
||||
|
||||
var path = getAppDir()/../"data"/zoneFile
|
||||
if not existsFile(path):
|
||||
if not fileExists(path):
|
||||
echo("Zone settings file does not exist: ../data/", zoneFile)
|
||||
echo(path)
|
||||
quit(1)
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ proc handleFileChallenge*(serv: PServer; buffer: PBuffer) =
|
|||
challenge = readScFileChallenge(buffer)
|
||||
path = expandPath(challenge)
|
||||
resp: CsFileChallenge
|
||||
if not existsFile(path):
|
||||
if not fileExists(path):
|
||||
resp.needFile = true
|
||||
echo "Got file challenge, need file."
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ template cacheImpl(procName, cacheName, resultType, body: untyped) {.dirty.} =
|
|||
cacheName[filename] = result
|
||||
|
||||
template checkFile(path: untyped) {.dirty.} =
|
||||
if not existsFile(path):
|
||||
if not fileExists(path):
|
||||
errors.add("File missing: " & path)
|
||||
|
||||
cacheImpl newSprite, SpriteSheets, PSpriteSheet:
|
||||
|
|
@ -322,7 +322,7 @@ proc validateSettings*(settings: JsonNode, errors: var seq[string]): bool =
|
|||
inc id
|
||||
|
||||
proc loadSettingsFromFile*(filename: string, errors: var seq[string]): bool =
|
||||
if not existsFile(filename):
|
||||
if not fileExists(filename):
|
||||
errors.add("File does not exist: "&filename)
|
||||
else:
|
||||
result = loadSettings(readFile(filename), errors)
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ when true:
|
|||
of cmdShortOption, cmdLongOption:
|
||||
case key
|
||||
of "f", "file":
|
||||
if existsFile(val):
|
||||
if fileExists(val):
|
||||
cfgFile = val
|
||||
else:
|
||||
echo("File does not exist: ", val)
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ when true:
|
|||
of cmdShortOption, cmdLongOption:
|
||||
case key
|
||||
of "f", "file":
|
||||
if existsFile(val):
|
||||
if fileExists(val):
|
||||
zoneCfgFile = val
|
||||
else:
|
||||
echo("File does not exist: ", val)
|
||||
|
|
@ -165,7 +165,7 @@ when true:
|
|||
dirServerInfo = jsonSettings["dirserver"]
|
||||
|
||||
var path = getAppDir()/../"data"/zoneFile
|
||||
if not existsFile(path):
|
||||
if not fileExists(path):
|
||||
echo("Zone settings file does not exist: ../data/", zoneFile)
|
||||
echo(path)
|
||||
quit(1)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ template withDir*(dir: string; body: untyped) =
|
|||
cd(curDir)
|
||||
|
||||
when true:
|
||||
if not existsFile("nakefile.nim"):
|
||||
if not fileExists("nakefile.nim"):
|
||||
echo "No nakefile.nim found. Current working dir is ", getCurrentDir()
|
||||
quit 1
|
||||
var args = ""
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ task "download", "download game assets":
|
|||
client = newHttpClient()
|
||||
path.add DirSep
|
||||
path.add(extractFilename(GameAssets))
|
||||
if existsFile(path):
|
||||
if fileExists(path):
|
||||
echo "The file already exists\n",
|
||||
"[R]emove [M]ove [Q]uit [S]kip Source: ", GameAssets
|
||||
case stdin.readLine.toLowerAscii
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const
|
|||
|
||||
proc runCmd(file, options = ""): auto =
|
||||
let fileabs = testsDir / file.unixToNativePath
|
||||
doAssert fileabs.existsFile, fileabs
|
||||
doAssert fileabs.fileExists, fileabs
|
||||
let cmd = fmt"{nim} {mode} {options} --hints:off {fileabs}"
|
||||
result = execCmdEx(cmd)
|
||||
when false: echo result[0] & "\n" & result[1] # for debugging
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ assert cmpic("HeLLO", "hello") == 0
|
|||
assert fileExists("tests/newconfig/tfoo.nims") == true
|
||||
assert dirExists("tests") == true
|
||||
|
||||
assert existsFile("tests/newconfig/tfoo.nims") == true
|
||||
assert fileExists("tests/newconfig/tfoo.nims") == true
|
||||
assert existsDir("tests") == true
|
||||
|
||||
discard selfExe()
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ proc genBadFileName(limit = 100): string =
|
|||
var hitLimit = true
|
||||
|
||||
for i in 0..100:
|
||||
if existsFile(result):
|
||||
if fileExists(result):
|
||||
result.add("a")
|
||||
else:
|
||||
hitLimit = false
|
||||
|
|
|
|||
|
|
@ -77,6 +77,5 @@ block:
|
|||
block: # #14142
|
||||
discard existsDir("/usr")
|
||||
discard dirExists("/usr")
|
||||
discard existsFile("/usr/foo")
|
||||
discard fileExists("/usr/foo")
|
||||
discard findExe("nim")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue