Commit 65d45902 authored by Laurent Belcour's avatar Laurent Belcour

[Scripts][Fix] PATH with parenthesis are no longer breaking the script

parent 7cc313ab
...@@ -10,15 +10,30 @@ ...@@ -10,15 +10,30 @@
:: This script can be launch using Administrator rights. In :: This script can be launch using Administrator rights. In
:: this case, the different PATHS will be permanent. :: this case, the different PATHS will be permanent.
:: ::
:: It can happens that the PATH variable contain directory
:: with parenthesis in them. In that case, we cannot use
:: a parenthesis for the IF ELSE statement. I use goto instead.
::
:: Source:
:: http://www.blinnov.com/en/2010/06/04/microsoft-was-unexpected-at-this-time/
net session >nul 2>&1 net session >nul 2>&1
if %ERRORLEVEL% equ 0 ( IF %ERRORLEVEL% EQU 0 GOTO superuser
setx ALTA_DIR "%~dp0sources" /M
setx ALTA_PLUGIN_PATH "%~dp0build\plugins" /M set ALTA_DIR=%~dp0sources
setx PATH "%PATH%;%~dp0build\softs" /M set ALTA_PLUGIN_PATH=%~dp0build\plugins
setx PYTHONPATH "%PYTHONPATH%;%~dp0build\python" /M set PATH=%PATH%;%~dp0build\softs
) else ( set PYTHONPATH=%PYTHONPATH%;%~dp0build\python
set ALTA_DIR=%~dp0sources REM set ALTA_DIR=%CD%\sources
set ALTA_PLUGIN_PATH=%~dp0build\plugins REM set ALTA_PLUGIN_PATH=%CD%\build\plugins
set PATH=%PATH%;%~dp0build\softs REM set PATH=%PATH%;%CD%\build\softs
set PYTHONPATH=%PYTHONPATH%;%~dp0build\python REM set PYTHONPATH=%PYTHONPATH%;%CD%\build\python
) GOTO:eof
:superuser
setx ALTA_DIR "%~dp0sources" /M
setx ALTA_PLUGIN_PATH "%~dp0build\plugins" /M
setx PATH "%PATH%;%~dp0build\softs" /M
setx PYTHONPATH "%PYTHONPATH%;%~dp0build\python" /M
GOTO:eof
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment