{.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
|
|
@ -9,7 +9,7 @@ proc process(dir, infile: string, outfile: File,
|
|||
processed: var HashSet[string]): ProcessResult =
|
||||
if processed.containsOrIncl(infile): return prSkipIncludeDir
|
||||
let toProcess = dir / infile
|
||||
if not existsFile(toProcess):
|
||||
if not fileExists(toProcess):
|
||||
echo "Warning: could not process: ", toProcess
|
||||
return prAddIncludeDir
|
||||
echo "adding: ", toProcess
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ proc findNimImpl*(): tuple[path: string, ok: bool] =
|
|||
let nim = "nim".exe
|
||||
result.path = "bin" / nim
|
||||
result.ok = true
|
||||
if existsFile(result.path): return
|
||||
if fileExists(result.path): return
|
||||
for dir in split(getEnv("PATH"), PathSep):
|
||||
result.path = dir / nim
|
||||
if existsFile(result.path): return
|
||||
if fileExists(result.path): return
|
||||
# assume there is a symlink to the exe or something:
|
||||
return (nim, false)
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ proc buildPdfDoc*(nimArgs, destPath: string) =
|
|||
removeFile(dest)
|
||||
moveFile(dest=dest, source=pdf)
|
||||
removeFile(changeFileExt(pdf, "aux"))
|
||||
if existsFile(changeFileExt(pdf, "toc")):
|
||||
if fileExists(changeFileExt(pdf, "toc")):
|
||||
removeFile(changeFileExt(pdf, "toc"))
|
||||
removeFile(changeFileExt(pdf, "log"))
|
||||
removeFile(changeFileExt(pdf, "out"))
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ proc walker(pattern; dir: string; counter: var int, errors: var int) =
|
|||
if optFollow in options and optRecursive in options and
|
||||
path.hasRightDirectory:
|
||||
walker(pattern, path, counter, errors)
|
||||
elif existsFile(dir):
|
||||
elif fileExists(dir):
|
||||
processFile(pattern, dir, counter, errors)
|
||||
else:
|
||||
printError "Error: no such file or directory: " & dir
|
||||
|
|
|
|||
|
|
@ -639,13 +639,13 @@ proc xzDist(c: var ConfigData; windowsZip=false) =
|
|||
proc processFile(destFile, src: string) =
|
||||
let dest = tmpDir / destFile
|
||||
when false: echo "Copying ", src, " to ", dest
|
||||
if not existsFile(src):
|
||||
if not fileExists(src):
|
||||
echo "[Warning] Source file doesn't exist: ", src
|
||||
let destDir = dest.splitFile.dir
|
||||
if not dirExists(destDir): createDir(destDir)
|
||||
copyFileWithPermissions(src, dest)
|
||||
|
||||
if not windowsZip and not existsFile("build" / buildBatFile):
|
||||
if not windowsZip and not fileExists("build" / buildBatFile):
|
||||
quit("No C sources found in ./build/, please build by running " &
|
||||
"./koch csource -d:release.")
|
||||
|
||||
|
|
@ -708,8 +708,8 @@ RunProgram="tools\downloader.exe"
|
|||
# -- prepare build files for .deb creation
|
||||
|
||||
proc debDist(c: var ConfigData) =
|
||||
if not existsFile(getOutputDir(c) / "build.sh"): quit("No build.sh found.")
|
||||
if not existsFile(getOutputDir(c) / "install.sh"): quit("No install.sh found.")
|
||||
if not fileExists(getOutputDir(c) / "build.sh"): quit("No build.sh found.")
|
||||
if not fileExists(getOutputDir(c) / "install.sh"): quit("No install.sh found.")
|
||||
|
||||
if c.debOpts.shortDesc == "": quit("shortDesc must be set in the .ini file.")
|
||||
if c.debOpts.licenses.len == 0:
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ proc walkDirRecursively(s: var seq[string], root, ext: string) =
|
|||
|
||||
proc addFiles(s: var seq[string], dir, ext: string, patterns: seq[string]) =
|
||||
for p in items(patterns):
|
||||
if existsFile(dir / addFileExt(p, ext)):
|
||||
if fileExists(dir / addFileExt(p, ext)):
|
||||
s.add(dir / addFileExt(p, ext))
|
||||
if existsDir(dir / p):
|
||||
walkDirRecursively(s, dir / p, ext)
|
||||
|
|
@ -273,9 +273,9 @@ proc findNim(c: TConfigData): string =
|
|||
if c.nimCompiler.len > 0: return c.nimCompiler
|
||||
var nim = "nim".exe
|
||||
result = "bin" / nim
|
||||
if existsFile(result): return
|
||||
if fileExists(result): return
|
||||
for dir in split(getEnv("PATH"), PathSep):
|
||||
if existsFile(dir / nim): return dir / nim
|
||||
if fileExists(dir / nim): return dir / nim
|
||||
# assume there is a symlink to the exe or something:
|
||||
return nim
|
||||
|
||||
|
|
@ -351,7 +351,7 @@ proc buildPdfDoc(c: var TConfigData, destPath: string) =
|
|||
removeFile(dest)
|
||||
moveFile(dest=dest, source=pdf)
|
||||
removeFile(changeFileExt(pdf, "aux"))
|
||||
if existsFile(changeFileExt(pdf, "toc")):
|
||||
if fileExists(changeFileExt(pdf, "toc")):
|
||||
removeFile(changeFileExt(pdf, "toc"))
|
||||
removeFile(changeFileExt(pdf, "log"))
|
||||
removeFile(changeFileExt(pdf, "out"))
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ proc vccVswhereExtractVcVarsAllPath(vswherePath: string): string =
|
|||
let vsPath = execProcess(&"\"{vswherePath}\" {vswhereArgs}").strip()
|
||||
if vsPath.len > 0:
|
||||
let vcvarsallPath = joinPath(vsPath, vcvarsRelativePath)
|
||||
if existsFile(vcvarsallPath):
|
||||
if fileExists(vcvarsallPath):
|
||||
return vcvarsallPath
|
||||
|
||||
proc vccVswhereGeneratePath(envName: string): string =
|
||||
|
|
@ -41,7 +41,7 @@ proc vccVswhereVcVarsAllPath*(): string =
|
|||
|
||||
for tryEnv in ["ProgramFiles(x86)", "ProgramFiles"]:
|
||||
let vswherePath = vccVswhereGeneratePath(tryEnv)
|
||||
if vswherePath.len > 0 and existsFile(vswherePath):
|
||||
if vswherePath.len > 0 and fileExists(vswherePath):
|
||||
let vcVarsAllPath = vccVswhereExtractVcVarsAllPath(vswherePath)
|
||||
if vcVarsAllPath.len > 0:
|
||||
return vcVarsAllPath
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue