Fixed ospaths compilation on js (#6826)
This commit is contained in:
parent
58c3e5d2f5
commit
c47ed6c537
1 changed files with 7 additions and 8 deletions
|
|
@ -602,14 +602,13 @@ proc quoteShellPosix*(s: string): string {.noSideEffect, rtl, extern: "nosp$1".}
|
||||||
else:
|
else:
|
||||||
return "'" & s.replace("'", "'\"'\"'") & "'"
|
return "'" & s.replace("'", "'\"'\"'") & "'"
|
||||||
|
|
||||||
|
when defined(windows) or defined(posix):
|
||||||
proc quoteShell*(s: string): string {.noSideEffect, rtl, extern: "nosp$1".} =
|
proc quoteShell*(s: string): string {.noSideEffect, rtl, extern: "nosp$1".} =
|
||||||
## Quote ``s``, so it can be safely passed to shell.
|
## Quote ``s``, so it can be safely passed to shell.
|
||||||
when defined(Windows):
|
when defined(windows):
|
||||||
return quoteShellWindows(s)
|
return quoteShellWindows(s)
|
||||||
elif defined(posix):
|
|
||||||
return quoteShellPosix(s)
|
|
||||||
else:
|
else:
|
||||||
{.error:"quoteShell is not supported on your system".}
|
return quoteShellPosix(s)
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
assert quoteShellWindows("aaa") == "aaa"
|
assert quoteShellWindows("aaa") == "aaa"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue