Special case quoting of certain explorer args

This is required for things like:

`explorer.exe /root,C:\a\folder` to spawn correctly.

Refs atom/tree-view#180
This commit is contained in:
Kevin Sawicki 2014-07-14 07:34:31 -07:00
parent b4ca3e46e6
commit 18818c9ba5

View File

@ -46,7 +46,13 @@ class BufferedProcess
if process.platform is "win32"
# Quote all arguments and escapes inner quotes
if args?
cmdArgs = args.map (arg) -> "\"#{arg.replace(/"/g, '\\"')}\""
cmdArgs = args.map (arg) ->
if command in ['explorer.exe', 'explorer'] and /^\/[a-zA-Z]+,.*$/.test(arg)
# Don't wrap /root,C:\folder style arguments to explorer calls in
# quotes # since they will not be interpreted correctly if they are
arg
else
"\"#{arg.replace(/"/g, '\\"')}\""
else
cmdArgs = []
cmdArgs.unshift("\"#{command}\"")