aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatkuki <kukovecmatic@hotmail.com>2019-10-23 16:53:43 +0200
committerGitHub <noreply@github.com>2019-10-23 16:53:43 +0200
commit3765862b6ee94ca661ca24a636af950bfc37d9c4 (patch)
treebb9c1bbcb750291d7cef96aa85ce6dcfcbbba434
parent36ef771ea82fe5c775100195d55e18e960fd5cc7 (diff)
downloadnimterop-3765862b6ee94ca661ca24a636af950bfc37d9c4.tar.gz
nimterop-3765862b6ee94ca661ca24a636af950bfc37d9c4.zip
Removed the regex stuff
-rw-r--r--nimterop/build.nim18
1 files changed, 10 insertions, 8 deletions
diff --git a/nimterop/build.nim b/nimterop/build.nim
index b2fbc48..cbf9b25 100644
--- a/nimterop/build.nim
+++ b/nimterop/build.nim
@@ -1,4 +1,4 @@
-import macros, osproc, sets, strformat, strutils, regex, tables
+import macros, osproc, sets, strformat, strutils, tables
import os except findExe, sleep
@@ -29,13 +29,15 @@ proc execAction*(cmd: string, retry = 0, nostderr = false): string =
ccmd = ""
ret = 0
when defined(Windows):
- var
- filteredCmd = cmd
- matches: RegexMatch
- if cmd.find(re"cd\s+(\D)\:", matches):
- var driveLetter = cmd[matches.group(0)[0]]
- filteredCmd = &"{driveLetter}: && {cmd}"
- echo filteredCmd
+ var filteredCmd = cmd
+ if cmd.toLower().startsWith("cd"):
+ var
+ colonIndex = cmd.find(":")
+ driveLetter = cmd.substr(colonIndex-1, colonIndex)
+ if (driveLetter[0].isAlphaAscii() and
+ driveLetter[1] == ':' and
+ colonIndex == 4):
+ filteredCmd = &"{driveLetter} && {cmd}"
ccmd = "cmd /c " & filteredCmd
elif defined(posix):
ccmd = cmd