diff options
author | Yuriy Glukhov <yglukhov@users.noreply.github.com> | 2017-11-27 16:52:49 -0800 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-11-28 01:52:49 +0100 |
commit | c47ed6c5374c330b892187d26e0360a97367507d (patch) | |
tree | f60cee51edf3d4919fa5657bc6aab8a13e90be43 /lib/pure/ospaths.nim | |
parent | 58c3e5d2f518d10f500dec9627fbe6c4c91dfc64 (diff) | |
download | Nim-c47ed6c5374c330b892187d26e0360a97367507d.tar.gz |
Fixed ospaths compilation on js (#6826)
Diffstat (limited to 'lib/pure/ospaths.nim')
-rw-r--r-- | lib/pure/ospaths.nim | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/pure/ospaths.nim b/lib/pure/ospaths.nim index c3bd399db..0d638abb9 100644 --- a/lib/pure/ospaths.nim +++ b/lib/pure/ospaths.nim @@ -602,14 +602,13 @@ proc quoteShellPosix*(s: string): string {.noSideEffect, rtl, extern: "nosp$1".} else: return "'" & s.replace("'", "'\"'\"'") & "'" -proc quoteShell*(s: string): string {.noSideEffect, rtl, extern: "nosp$1".} = - ## Quote ``s``, so it can be safely passed to shell. - when defined(Windows): - return quoteShellWindows(s) - elif defined(posix): - return quoteShellPosix(s) - else: - {.error:"quoteShell is not supported on your system".} +when defined(windows) or defined(posix): + proc quoteShell*(s: string): string {.noSideEffect, rtl, extern: "nosp$1".} = + ## Quote ``s``, so it can be safely passed to shell. + when defined(windows): + return quoteShellWindows(s) + else: + return quoteShellPosix(s) when isMainModule: assert quoteShellWindows("aaa") == "aaa" |