summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-10-23 00:53:40 -0700
committerJason Zaugg <jzaugg@gmail.com>2013-10-23 00:53:40 -0700
commite6a5e692f58892dcf080fb3fe4fc4f8100e63301 (patch)
treed43cb2b2ddab3a6b2187664c2df9316c5f41dfcb
parent371bad2fe657d7fd065a47dc38fa5ae1fea882a7 (diff)
parent25bcba59ce37bdb19ec784edaecfd033eef27037 (diff)
downloadscala-e6a5e692f58892dcf080fb3fe4fc4f8100e63301.tar.gz
scala-e6a5e692f58892dcf080fb3fe4fc4f8100e63301.tar.bz2
scala-e6a5e692f58892dcf080fb3fe4fc4f8100e63301.zip
Merge pull request #3065 from retronym/ticket/7295
Fix windows batch file with args containing parentheses
-rw-r--r--src/compiler/scala/tools/ant/templates/tool-windows.tmpl17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl
index 1288eb0b7c..8441f3af23 100644
--- a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl
+++ b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl
@@ -12,15 +12,18 @@ setlocal enableextensions enabledelayedexpansion
set _LINE_TOOLCP=
-:another_param
-
rem Use "%~1" to handle spaces in paths. See http://ss64.com/nt/syntax-args.html
-if "%~1"=="-toolcp" (
- set _LINE_TOOLCP=%~2
- shift
- shift
- goto another_param
+rem SI-7295 The goto here is needed to avoid problems with `scala Script.cmd "arg(with)paren"`,
+rem we must not evaluate %~2 eagerly, but delayed expansion doesn't seem to allow
+rem removal of quotation marks.
+if not [%~1]==[-toolcp] (
+ goto :notoolcp
)
+shift
+set _LINE_TOOLCP=%~1
+shift
+
+:notoolcp
rem We keep in _JAVA_PARAMS all -J-prefixed and -D-prefixed arguments
set _JAVA_PARAMS=