Fix osx find error
This commit is contained in:
parent
d9350cf47e
commit
6410758117
1 changed files with 10 additions and 3 deletions
|
|
@ -278,9 +278,16 @@ proc findFile*(file: string, dir: string, recurse = true, first = false, regex =
|
||||||
when not defined(windows):
|
when not defined(windows):
|
||||||
recursive = "-maxdepth 1"
|
recursive = "-maxdepth 1"
|
||||||
|
|
||||||
let
|
var
|
||||||
dir = if not regex: dir / file.parentDir() else: dir
|
dir = dir
|
||||||
file = if not regex: file.extractFilename else: file
|
file = file
|
||||||
|
if not recurse:
|
||||||
|
let
|
||||||
|
pdir = file.parentDir()
|
||||||
|
if pdir.len != 0:
|
||||||
|
dir = dir / pdir
|
||||||
|
|
||||||
|
file = file.extractFilename
|
||||||
|
|
||||||
cmd = cmd % [recursive, (".*[\\\\/]" & file & "$").quoteShell, dir.sanitizePath]
|
cmd = cmd % [recursive, (".*[\\\\/]" & file & "$").quoteShell, dir.sanitizePath]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue