diff options
author | Michał Zieliński <michal@zielinscy.org.pl> | 2013-12-11 22:27:39 +0100 |
---|---|---|
committer | Michał Zieliński <michal@zielinscy.org.pl> | 2013-12-11 22:27:39 +0100 |
commit | 39cabcdd2702098825eba32fcbc6737b9aa45e6e (patch) | |
tree | 3b7c197d58d2a0f55692df9dc9a2416c53944a09 /lib | |
parent | c36319727558f92a47f7aa5fed1d696d63b48d65 (diff) | |
download | Nim-39cabcdd2702098825eba32fcbc6737b9aa45e6e.tar.gz |
Use quoteShell in stdlib, where appropriate.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/browsers.nim | 4 | ||||
-rw-r--r-- | lib/pure/osproc.nim | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/pure/browsers.nim b/lib/pure/browsers.nim index 6f5bf7ddb..b44f406c5 100644 --- a/lib/pure/browsers.nim +++ b/lib/pure/browsers.nim @@ -33,10 +33,10 @@ proc openDefaultBrowser*(url: string) = else: discard ShellExecuteA(0'i32, "open", url, nil, nil, SW_SHOWNORMAL) elif defined(macosx): - discard execShellCmd("open " & quoteIfContainsWhite(url)) + discard execShellCmd("open " & quoteShell(url)) else: const attempts = ["gnome-open ", "kde-open ", "xdg-open "] - var u = quoteIfContainsWhite(url) + var u = quoteShell(url) for a in items(attempts): if execShellCmd(a & u) == 0: return for b in getEnv("BROWSER").string.split(PathSep): diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index 7772585a9..61b940ce8 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -359,10 +359,10 @@ when defined(Windows) and not defined(useNimRtl): result.writeDataImpl = hsWriteData proc buildCommandLine(a: string, args: openarray[string]): cstring = - var res = quoteIfContainsWhite(a) + var res = quoteShell(a) for i in 0..high(args): res.add(' ') - res.add(quoteIfContainsWhite(args[i])) + res.add(quoteShell(args[i])) result = cast[cstring](alloc0(res.len+1)) copyMem(result, cstring(res), res.len) @@ -562,10 +562,10 @@ elif not defined(useNimRtl): writeIdx = 1 proc addCmdArgs(command: string, args: openarray[string]): string = - result = quoteIfContainsWhite(command) + result = quoteShell(command) for i in 0 .. high(args): add(result, " ") - add(result, quoteIfContainsWhite(args[i])) + add(result, quoteShell(args[i])) proc toCStringArray(b, a: openarray[string]): cstringArray = result = cast[cstringArray](alloc0((a.len + b.len + 1) * sizeof(cstring))) |