Removed the regex stuff
This commit is contained in:
parent
36ef771ea8
commit
3765862b6e
1 changed files with 10 additions and 8 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import macros, osproc, sets, strformat, strutils, regex, tables
|
import macros, osproc, sets, strformat, strutils, tables
|
||||||
|
|
||||||
import os except findExe, sleep
|
import os except findExe, sleep
|
||||||
|
|
||||||
|
|
@ -29,13 +29,15 @@ proc execAction*(cmd: string, retry = 0, nostderr = false): string =
|
||||||
ccmd = ""
|
ccmd = ""
|
||||||
ret = 0
|
ret = 0
|
||||||
when defined(Windows):
|
when defined(Windows):
|
||||||
var
|
var filteredCmd = cmd
|
||||||
filteredCmd = cmd
|
if cmd.toLower().startsWith("cd"):
|
||||||
matches: RegexMatch
|
var
|
||||||
if cmd.find(re"cd\s+(\D)\:", matches):
|
colonIndex = cmd.find(":")
|
||||||
var driveLetter = cmd[matches.group(0)[0]]
|
driveLetter = cmd.substr(colonIndex-1, colonIndex)
|
||||||
filteredCmd = &"{driveLetter}: && {cmd}"
|
if (driveLetter[0].isAlphaAscii() and
|
||||||
echo filteredCmd
|
driveLetter[1] == ':' and
|
||||||
|
colonIndex == 4):
|
||||||
|
filteredCmd = &"{driveLetter} && {cmd}"
|
||||||
ccmd = "cmd /c " & filteredCmd
|
ccmd = "cmd /c " & filteredCmd
|
||||||
elif defined(posix):
|
elif defined(posix):
|
||||||
ccmd = cmd
|
ccmd = cmd
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue