[jboss-cvs] JBossAS SVN: r114559 - branches/JBPAPP_5/main/src/bin.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 14 07:19:48 EST 2013


Author: tfonteyn
Date: 2013-11-14 07:19:47 -0500 (Thu, 14 Nov 2013)
New Revision: 114559

Modified:
   branches/JBPAPP_5/main/src/bin/run.bat
Log:
[JBPAPP-10804] run.bat -r option to use a custom run.conf.bat file causes options like -Dfoo=bar to fail

Modified: branches/JBPAPP_5/main/src/bin/run.bat
===================================================================
--- branches/JBPAPP_5/main/src/bin/run.bat	2013-11-06 09:28:49 UTC (rev 114558)
+++ branches/JBPAPP_5/main/src/bin/run.bat	2013-11-14 12:19:47 UTC (rev 114559)
@@ -15,26 +15,48 @@
   set "DIRNAME=.\"
   set "PROGNAME=run.bat"
 )
-rem check the arguments for -r to set the config file
-SET ARGS=
+rem check the arguments
+set PROFILE_DIR=default
+set ARGS=
+set params=%*
 :LoopArgs
-if "%1"=="" GOTO ContinueArgs
-if "%1"=="-r" (
-   rem set desired run.conf.bat
-   SET RUN_CONF=%2
-   SHIFT
-   SHIFT
-) else (
-   rem keep to pass on to JBoss server
-   SET ARGS=%ARGS% %1
-   SHIFT
+for /f "usebackq tokens=1,*" %%A in ('!params!') do (
+  if "%%A"=="-r" (
+      rem "-r" allows you to specify a custom run.conf.bat file
+      rem remove "-r"
+      set params=%%B
+      rem next param we split of is the filename
+      for /f "usebackq tokens=1,*" %%P in ('!params!') do (
+        SET RUN_CONF=%%P
+        rem remove filename
+        set params=%%Q
+      )
+  ) else if "%%A"=="-c" (
+      rem get the profile directory for executing a local run.conf.bat
+      set params=%%B
+      for /f "usebackq tokens=1,*" %%P in ('!params!') do (
+        set PROFILE_DIR=%%P
+        set params=%%Q
+        rem we still need to pass the profile to the java process !
+        set ARGS=%ARGS% -c %%P
+      )
+  ) else (
+      rem keep to pass on to JBoss server
+      set ARGS=%ARGS% %%A
+      set params=%%B
+  )
 )
-GOTO LoopArgs
-:ContinueArgs
+if not "!params!"=="" goto LoopArgs
 
 rem Read an optional configuration file.
 if "x%RUN_CONF%" == "x" (
-   set "RUN_CONF=%DIRNAME%run.conf.bat"
+  if exist "%DIRNAME%..\server\%PROFILE_DIR%\conf\run.conf.bat" (
+    set "RUN_CONF=%DIRNAME%..\server\%PROFILE_DIR%\conf\run.conf.bat"
+  ) else if exist "%DIRNAME%..\server\%PROFILE_DIR%\run.conf.bat" (
+    set "RUN_CONF=%DIRNAME%..\server\%PROFILE_DIR%\run.conf.bat"
+  ) else (
+    set "RUN_CONF=%DIRNAME%run.conf.bat"
+  )
 )
 if exist "%RUN_CONF%" (
    echo "Calling %RUN_CONF%"



More information about the jboss-cvs-commits mailing list