deprecate existsDir; use dirExists instead (#14884)

This commit is contained in:
Timothee Cour 2020-07-03 14:04:23 -07:00 • committed by GitHub
commit 695154970d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 32 additions and 39 deletions

View file

@ -495,7 +495,7 @@ proc styleInsensitive(s: string): string =
else: addx()
proc walker(pattern; dir: string; counter: var int, errors: var int) =
if existsDir(dir):
if dirExists(dir):
for kind, path in walkDir(dir):
case kind
of pcFile:

View file

@ -251,12 +251,12 @@ proc walkDirRecursively(s: var seq[string], root, explicit: string,
proc addFiles(s: var seq[string], patterns: seq[string]) =
for p in items(patterns):
if existsDir(p):
if dirExists(p):
walkDirRecursively(s, p, p, false)
else:
var i = 0
for f in walkPattern(p):
if existsDir(f):
if dirExists(f):
walkDirRecursively(s, f, p, false)
elif not ignoreFile(f, p, false):
add(s, unixToNativePath(f))
@ -518,7 +518,7 @@ template gatherFiles(fun, libpath, outDir) =
proc srcdist(c: var ConfigData) =
let cCodeDir = getOutputDir(c) / "c_code"
if not existsDir(cCodeDir): createDir(cCodeDir)
if not dirExists(cCodeDir): createDir(cCodeDir)
gatherFiles(copyFile, c.libpath, cCodeDir)
var winIndex = -1
var intel32Index = -1
@ -532,7 +532,7 @@ proc srcdist(c: var ConfigData) =
if cpuname.cmpIgnoreStyle("i386") == 0: intel32Index = cpuA
elif cpuname.cmpIgnoreStyle("amd64") == 0: intel64Index = cpuA
var dir = getOutputDir(c) / buildDir(osA, cpuA)
if existsDir(dir): removeDir(dir)
if dirExists(dir): removeDir(dir)
createDir(dir)
var cmd = ("nim compile -f --symbolfiles:off --compileonly " &
"--gen_mapping --cc:gcc --skipUserCfg" &

View file

@ -201,7 +201,7 @@ proc addFiles(s: var seq[string], dir, ext: string, patterns: seq[string]) =
for p in items(patterns):
if fileExists(dir / addFileExt(p, ext)):
s.add(dir / addFileExt(p, ext))
if existsDir(dir / p):
if dirExists(dir / p):
walkDirRecursively(s, dir / p, ext)
proc parseIniFile(c: var TConfigData) =
@ -483,7 +483,7 @@ proc buildPage(c: var TConfigData, file, title, rss: string, assetDir = "") =
quit("[Error] cannot open: " & temp)
var f: File
var outfile = c.webUploadOutput / "$#.html" % file
if not existsDir(outfile.splitFile.dir):
if not dirExists(outfile.splitFile.dir):
createDir(outfile.splitFile.dir)
if open(f, outfile, fmWrite):
writeLine(f, generateHTMLPage(c, file, title, content, rss, assetDir))