Skip to content

Commit

Permalink
[WFLY-1358] Better support for spaces in paths on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jamezp authored and n1hility committed May 17, 2013
1 parent 0aa80ca commit 7c94ebf
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 92 deletions.
32 changes: 21 additions & 11 deletions build/src/main/resources/bin/add-user.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,26 @@ pushd %DIRNAME%..
set "RESOLVED_JBOSS_HOME=%CD%"
popd

if "x%JBOSS_HOME%" == "x" (
set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
set UNQUOTED_JBOSS_HOME=%JBOSS_HOME:"=%
rem attempt to unquote again to remove quote if envvar was not set
set UNQUOTED_JBOSS_HOME=%UNQUOTED_JBOSS_HOME:"=%
set QUOTED_JBOSS_HOME="%UNQUOTED_JBOSS_HOME%"
rem should only a = if envvar was not set
if "%UNQUOTED_JBOSS_HOME%" == "=" (
set "UNQUOTED_JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
set QUOTED_JBOSS_HOME="%RESOLVED_JBOSS_HOME%"
set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
)

pushd "%JBOSS_HOME%"
pushd %QUOTED_JBOSS_HOME%
set "SANITIZED_JBOSS_HOME=%CD%"
popd

if "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
echo WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
if /i "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
echo.
echo WARNING: JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
echo.
echo JBOSS_HOME: %QUOTED_JBOSS_HOME%
echo.
)

set DIRNAME=
Expand All @@ -51,10 +61,10 @@ if "x%JAVA_HOME%" == "x" (
)

rem Find jboss-modules.jar, or we can't continue
if exist "%JBOSS_HOME%\jboss-modules.jar" (
set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar"
if exist "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar" (
set "RUNJAR=%UNQUOTED_JBOSS_HOME%\jboss-modules.jar"
) else (
echo Could not locate "%JBOSS_HOME%\jboss-modules.jar".
echo Could not locate "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar".
echo Please check that you are in the bin directory when running this script.
goto END
)
Expand All @@ -63,14 +73,14 @@ rem Setup JBoss specific properties

rem Set default module root paths
if "x%JBOSS_MODULEPATH%" == "x" (
set "JBOSS_MODULEPATH=%JBOSS_HOME%\modules"
set "JBOSS_MODULEPATH=%UNQUOTED_JBOSS_HOME%\modules"
)

rem Uncomment to override standalone and domain user location
rem set "JAVA_OPTS=%JAVA_OPTS% -Djboss.server.config.user.dir=..\standalone\configuration -Djboss.domain.config.user.dir=..\domain\configuration"

"%JAVA%" %JAVA_OPTS% ^
-jar "%JBOSS_HOME%\jboss-modules.jar" ^
-jar "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar" ^
-mp "%JBOSS_MODULEPATH%" ^
org.jboss.as.domain-add-user ^
%*
Expand Down
39 changes: 24 additions & 15 deletions build/src/main/resources/bin/appclient.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,25 @@ pushd %DIRNAME%..
set "RESOLVED_JBOSS_HOME=%CD%"
popd

if "x%JBOSS_HOME%" == "x" (
set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
set UNQUOTED_JBOSS_HOME=%JBOSS_HOME:"=%
rem attempt to unquote again to remove quote if envvar was not set
set UNQUOTED_JBOSS_HOME=%UNQUOTED_JBOSS_HOME:"=%
set QUOTED_JBOSS_HOME="%UNQUOTED_JBOSS_HOME%"
rem should only a = if envvar was not set
if "%UNQUOTED_JBOSS_HOME%" == "=" (
set "UNQUOTED_JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
set QUOTED_JBOSS_HOME="%RESOLVED_JBOSS_HOME%"
)

pushd "%JBOSS_HOME%"
pushd %QUOTED_JBOSS_HOME%
set "SANITIZED_JBOSS_HOME=%CD%"
popd

if "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
echo WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
if /i "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
echo.
echo WARNING: JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
echo.
echo JBOSS_HOME: %QUOTED_JBOSS_HOME%
echo.
)

set DIRNAME=
Expand Down Expand Up @@ -67,10 +76,10 @@ if not errorlevel == 1 (
)

rem Find run.jar, or we can't continue
if exist "%JBOSS_HOME%\jboss-modules.jar" (
set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar"
if exist "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar" (
set "RUNJAR=%UNQUOTED_JBOSS_HOME%\jboss-modules.jar"
) else (
echo Could not locate "%JBOSS_HOME%\jboss-modules.jar".
echo Could not locate "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar".
echo Please check that you are in the bin directory when running this script.
goto END
)
Expand All @@ -79,15 +88,15 @@ rem Setup JBoss specific properties

rem Set default module root paths
if "x%JBOSS_MODULEPATH%" == "x" (
set "JBOSS_MODULEPATH=%JBOSS_HOME%\modules"
set "JBOSS_MODULEPATH=%UNQUOTED_JBOSS_HOME%\modules"
)

"%JAVA%" %JAVA_OPTS% ^
"-Dorg.jboss.boot.log.file=%JBOSS_HOME%\appclient\log\appclient.log" ^
"-Dlogging.configuration=file:%JBOSS_HOME%/appclient/configuration/logging.properties" ^
-jar "%JBOSS_HOME%\jboss-modules.jar" ^
"-Dorg.jboss.boot.log.file=%UNQUOTED_JBOSS_HOME%\appclient\log\appclient.log" ^
"-Dlogging.configuration=file:%UNQUOTED_JBOSS_HOME%/appclient/configuration/logging.properties" ^
-jar "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar" ^
-mp "%JBOSS_MODULEPATH%" ^
org.jboss.as.appclient ^
-Djboss.home.dir="%JBOSS_HOME%" ^
-Djboss.server.base.dir="%JBOSS_HOME%\appclient" ^
-Djboss.home.dir="%UNQUOTED_JBOSS_HOME%" ^
-Djboss.server.base.dir="%UNQUOTED_JBOSS_HOME%\appclient" ^
%*
36 changes: 23 additions & 13 deletions build/src/main/resources/bin/domain.bat
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,26 @@ pushd %DIRNAME%..
set "RESOLVED_JBOSS_HOME=%CD%"
popd

if "x%JBOSS_HOME%" == "x" (
set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
set UNQUOTED_JBOSS_HOME=%JBOSS_HOME:"=%
rem attempt to unquote again to remove quote if envvar was not set
set UNQUOTED_JBOSS_HOME=%UNQUOTED_JBOSS_HOME:"=%
set QUOTED_JBOSS_HOME="%UNQUOTED_JBOSS_HOME%"
rem should only a = if envvar was not set
if "%UNQUOTED_JBOSS_HOME%" == "=" (
set "UNQUOTED_JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
set QUOTED_JBOSS_HOME="%RESOLVED_JBOSS_HOME%"
)

pushd "%JBOSS_HOME%"
pushd %QUOTED_JBOSS_HOME%
set "SANITIZED_JBOSS_HOME=%CD%"
popd

if "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
echo WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
if /i "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
echo.
echo WARNING: JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
echo.
echo JBOSS_HOME: %QUOTED_JBOSS_HOME%
echo.
)

set DIRNAME=
Expand Down Expand Up @@ -70,10 +80,10 @@ if not errorlevel == 1 (
)

rem Find run.jar, or we can't continue
if exist "%JBOSS_HOME%\jboss-modules.jar" (
set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar"
if exist "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar" (
set "RUNJAR=%UNQUOTED_JBOSS_HOME%\jboss-modules.jar"
) else (
echo Could not locate "%JBOSS_HOME%\jboss-modules.jar".
echo Could not locate "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar".
echo Please check that you are in the bin directory when running this script.
goto END
)
Expand Down Expand Up @@ -112,12 +122,12 @@ rem Setup JBoss specific properties

rem Set default module root paths
if "x%JBOSS_MODULEPATH%" == "x" (
set "JBOSS_MODULEPATH=%JBOSS_HOME%\modules"
set "JBOSS_MODULEPATH=%UNQUOTED_JBOSS_HOME%\modules"
)

rem Set the domain base dir
if "x%JBOSS_BASE_DIR%" == "x" (
set "JBOSS_BASE_DIR=%JBOSS_HOME%\domain"
set "JBOSS_BASE_DIR=%UNQUOTED_JBOSS_HOME%\domain"
)
rem Set the domain log dir
if "x%JBOSS_LOG_DIR%" == "x" (
Expand All @@ -132,7 +142,7 @@ echo ===========================================================================
echo.
echo JBoss Bootstrap Environment
echo.
echo JBOSS_HOME: %JBOSS_HOME%
echo JBOSS_HOME: %UNQUOTED_JBOSS_HOME%
echo.
echo JAVA: %JAVA%
echo.
Expand All @@ -145,10 +155,10 @@ echo.
"%JAVA%" %PROCESS_CONTROLLER_JAVA_OPTS% ^
"-Dorg.jboss.boot.log.file=%JBOSS_LOG_DIR%\process-controller.log" ^
"-Dlogging.configuration=file:%JBOSS_CONFIG_DIR%/logging.properties" ^
-jar "%JBOSS_HOME%\jboss-modules.jar" ^
-jar "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar" ^
-mp "%JBOSS_MODULEPATH%" ^
org.jboss.as.process-controller ^
-jboss-home "%JBOSS_HOME%" ^
-jboss-home "%UNQUOTED_JBOSS_HOME%" ^
-jvm "%JAVA%" ^
-mp "%JBOSS_MODULEPATH%" ^
-- ^
Expand Down
30 changes: 20 additions & 10 deletions build/src/main/resources/bin/jboss-cli.bat
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,26 @@ pushd %DIRNAME%..
set "RESOLVED_JBOSS_HOME=%CD%"
popd

if "x%JBOSS_HOME%" == "x" (
set UNQUOTED_JBOSS_HOME=%JBOSS_HOME:"=%
rem attempt to unquote again to remove quote if envvar was not set
set UNQUOTED_JBOSS_HOME=%UNQUOTED_JBOSS_HOME:"=%
set QUOTED_JBOSS_HOME="%UNQUOTED_JBOSS_HOME%"
rem should only a = if envvar was not set
if "%UNQUOTED_JBOSS_HOME%" == "=" (
set "UNQUOTED_JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
set QUOTED_JBOSS_HOME="%RESOLVED_JBOSS_HOME%"
set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
)

pushd "%JBOSS_HOME%"
pushd %QUOTED_JBOSS_HOME%
set "SANITIZED_JBOSS_HOME=%CD%"
popd

if "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
echo WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
if /i "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
echo.
echo WARNING: JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
echo.
echo JBOSS_HOME: %QUOTED_JBOSS_HOME%
echo.
)

set DIRNAME=
Expand All @@ -50,10 +60,10 @@ if "x%JAVA_HOME%" == "x" (
)

rem Find run.jar, or we can't continue
if exist "%JBOSS_HOME%\jboss-modules.jar" (
set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar"
if exist "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar" (
set "RUNJAR=%UNQUOTED_JBOSS_HOME%\jboss-modules.jar"
) else (
echo Could not locate "%JBOSS_HOME%\jboss-modules.jar".
echo Could not locate "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar".
echo Please check that you are in the bin directory when running this script.
goto END
)
Expand All @@ -62,8 +72,8 @@ rem Add base package for L&F
set JAVA_OPTS=%JAVA_OPTS% -Djboss.modules.system.pkgs=com.sun.java.swing

"%JAVA%" %JAVA_OPTS% ^
-jar "%JBOSS_HOME%\jboss-modules.jar" ^
-mp "%JBOSS_HOME%\modules" ^
-jar "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar" ^
-mp "%UNQUOTED_JBOSS_HOME%\modules" ^
org.jboss.as.cli ^
%*

Expand Down
28 changes: 19 additions & 9 deletions build/src/main/resources/bin/jconsole.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,26 @@ pushd %DIRNAME%..
set "RESOLVED_JBOSS_HOME=%CD%"
popd

if "x%JBOSS_HOME%" == "x" (
set UNQUOTED_JBOSS_HOME=%JBOSS_HOME:"=%
rem attempt to unquote again to remove quote if envvar was not set
set UNQUOTED_JBOSS_HOME=%UNQUOTED_JBOSS_HOME:"=%
set QUOTED_JBOSS_HOME="%UNQUOTED_JBOSS_HOME%"
rem should only a = if envvar was not set
if "%UNQUOTED_JBOSS_HOME%" == "=" (
set "UNQUOTED_JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
set QUOTED_JBOSS_HOME="%RESOLVED_JBOSS_HOME%"
set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
)

pushd "%JBOSS_HOME%"
pushd %QUOTED_JBOSS_HOME%
set "SANITIZED_JBOSS_HOME=%CD%"
popd

if "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
echo WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
if /i "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
echo.
echo WARNING: JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
echo.
echo JBOSS_HOME: %QUOTED_JBOSS_HOME%
echo.
)

set DIRNAME=
Expand All @@ -47,17 +57,17 @@ if "x%JAVA_HOME%" == "x" (
)

rem Find jboss-modules.jar, or we can't continue
if exist "%JBOSS_HOME%\jboss-modules.jar" (
set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar"
if exist "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar" (
set "RUNJAR=%UNQUOTED_JBOSS_HOME%\jboss-modules.jar"
) else (
echo Could not locate "%JBOSS_HOME%\jboss-modules.jar".
echo Could not locate "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar".
echo Please check that you are in the bin directory when running this script.
goto END
)

rem Set default module root paths
if "x%JBOSS_MODULEPATH%" == "x" (
set "JBOSS_MODULEPATH=%JBOSS_HOME%\modules"
set "JBOSS_MODULEPATH=%UNQUOTED_JBOSS_HOME%\modules"
)

rem Setup The Classpath
Expand Down
34 changes: 22 additions & 12 deletions build/src/main/resources/bin/jdr.bat
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,26 @@ pushd %DIRNAME%..
set "RESOLVED_JBOSS_HOME=%CD%"
popd

if "x%JBOSS_HOME%" == "x" (
set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
set UNQUOTED_JBOSS_HOME=%JBOSS_HOME:"=%
rem attempt to unquote again to remove quote if envvar was not set
set UNQUOTED_JBOSS_HOME=%UNQUOTED_JBOSS_HOME:"=%
set QUOTED_JBOSS_HOME="%UNQUOTED_JBOSS_HOME%"
rem should only a = if envvar was not set
if "%UNQUOTED_JBOSS_HOME%" == "=" (
set "UNQUOTED_JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
set QUOTED_JBOSS_HOME="%RESOLVED_JBOSS_HOME%"
set "JBOSS_HOME=%%RESOLVED_JBOSS_HOME%"
)

pushd "%JBOSS_HOME%"
pushd %QUOTED_JBOSS_HOME%
set "SANITIZED_JBOSS_HOME=%CD%"
popd

if "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
echo WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
if /i "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
echo.
echo WARNING: JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
echo.
echo JBOSS_HOME: %QUOTED_JBOSS_HOME%
echo.
)

set DIRNAME=
Expand All @@ -53,10 +63,10 @@ if "x%JAVA_HOME%" == "x" (
)

rem Find jboss-modules.jar, or we can't continue
if exist "%JBOSS_HOME%\jboss-modules.jar" (
set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar"
if exist "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar" (
set "RUNJAR=%UNQUOTED_JBOSS_HOME%\jboss-modules.jar"
) else (
echo Could not locate "%JBOSS_HOME%\jboss-modules.jar".
echo Could not locate "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar".
echo Please check that you are in the bin directory when running this script.
goto END
)
Expand All @@ -65,12 +75,12 @@ rem Setup JBoss specific properties

rem Set default module root paths
if "x%JBOSS_MODULEPATH%" == "x" (
set "JBOSS_MODULEPATH=%JBOSS_HOME%\modules"
set "JBOSS_MODULEPATH=%UNQUOTED_JBOSS_HOME%\modules"
)

"%JAVA%" ^
-Djboss.home.dir="%JBOSS_HOME%" ^
-jar "%JBOSS_HOME%\jboss-modules.jar" ^
-Djboss.home.dir="%UNQUOTED_JBOSS_HOME%" ^
-jar "%UNQUOTED_JBOSS_HOME%\jboss-modules.jar" ^
-mp "%JBOSS_MODULEPATH%" ^
org.jboss.as.jdr ^
%*
Loading

0 comments on commit 7c94ebf

Please sign in to comment.