fixes #6939
This commit is contained in:
parent
274fafb2df
commit
4f9ae61695
1 changed files with 10 additions and 5 deletions
|
|
@ -139,10 +139,15 @@ proc findExe*(exe: string, followSymlinks: bool = true;
|
||||||
## is added the `ExeExts <#ExeExts>`_ file extensions if it has none.
|
## is added the `ExeExts <#ExeExts>`_ file extensions if it has none.
|
||||||
## If the system supports symlinks it also resolves them until it
|
## If the system supports symlinks it also resolves them until it
|
||||||
## meets the actual file. This behavior can be disabled if desired.
|
## meets the actual file. This behavior can be disabled if desired.
|
||||||
for ext in extensions:
|
template checkCurrentDir() =
|
||||||
result = addFileExt(exe, ext)
|
for ext in extensions:
|
||||||
if existsFile(result): return
|
result = addFileExt(exe, ext)
|
||||||
var path = string(getEnv("PATH"))
|
if existsFile(result): return
|
||||||
|
when defined(posix):
|
||||||
|
if '/' in exe: checkCurrentDir()
|
||||||
|
else:
|
||||||
|
checkCurrentDir()
|
||||||
|
let path = string(getEnv("PATH"))
|
||||||
for candidate in split(path, PathSep):
|
for candidate in split(path, PathSep):
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
var x = (if candidate[0] == '"' and candidate[^1] == '"':
|
var x = (if candidate[0] == '"' and candidate[^1] == '"':
|
||||||
|
|
@ -824,7 +829,7 @@ iterator walkDir*(dir: string; relative=false): tuple[kind: PathComponent, path:
|
||||||
|
|
||||||
iterator walkDirRec*(dir: string, yieldFilter = {pcFile},
|
iterator walkDirRec*(dir: string, yieldFilter = {pcFile},
|
||||||
followFilter = {pcDir}): string {.tags: [ReadDirEffect].} =
|
followFilter = {pcDir}): string {.tags: [ReadDirEffect].} =
|
||||||
## Recursively walks over the directory `dir` and yields for each file
|
## Recursively walks over the directory `dir` and yields for each file
|
||||||
## or directory in `dir`.
|
## or directory in `dir`.
|
||||||
## The full path for each file or directory is returned.
|
## The full path for each file or directory is returned.
|
||||||
## **Warning**:
|
## **Warning**:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue