aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nimterop/build.nim12
1 files changed, 7 insertions, 5 deletions
diff --git a/nimterop/build.nim b/nimterop/build.nim
index ce76914..bcbd96a 100644
--- a/nimterop/build.nim
+++ b/nimterop/build.nim
@@ -264,8 +264,10 @@ proc findFile*(file: string, dir: string, recurse = true, first = false, regex =
cmd =
when defined(windows):
"nimgrep --filenames --oneline --nocolor $1 $2 $3"
- else:
+ elif defined(linux):
"find $3 $1 -regextype egrep -regex $2"
+ elif defined(osx):
+ "find -E $3 $1 -regex $2"
recursive = ""
@@ -281,7 +283,7 @@ proc findFile*(file: string, dir: string, recurse = true, first = false, regex =
dir = dir / file.parentDir()
file = file.extractFilename
- cmd = cmd % [recursive, (".*[\\/]" & file & "$").quoteShell, dir.sanitizePath]
+ cmd = cmd % [recursive, (".*[\\\\/]" & file & "$").quoteShell, dir.sanitizePath]
let
(files, ret) = gorgeEx(cmd)
@@ -289,14 +291,14 @@ proc findFile*(file: string, dir: string, recurse = true, first = false, regex =
for line in files.splitLines():
let f =
when defined(windows):
- if ":" in line:
- line.split(":", maxsplit = 1)[0]
+ if ": " in line:
+ line.split(": ", maxsplit = 1)[1]
else:
""
else:
line
- if (f.len != 0 and result.len == 0 or result.len > f.len):
+ if (f.len != 0 and (result.len == 0 or result.len > f.len)):
result = f
if first: break