Skip to content

Commit

Permalink
Merge pull request #210 from mcottontensor/windows_script_path
Browse files Browse the repository at this point in the history
Simplifying windows path modification for node
  • Loading branch information
mcottontensor authored Jul 25, 2024
2 parents ed0027a + 34977d8 commit 635a68b
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions SignallingWebServer/platform_scripts/cmd/common.bat
Original file line number Diff line number Diff line change
Expand Up @@ -158,25 +158,7 @@ IF NOT exist "%FRONTEND_DIR%\player.html" (
set FORCE_BUILD=1
)

rem Query the registry to get the value of the PATH variable for the current user (We DO NOT want the system PATH - %PATH% combines user and system PATH.)
for /f "tokens=2*" %%A in ('reg query "HKCU\Environment" /v PATH ^| find "PATH"') do (
set "USER_PATH=%%B"
)

rem Store user's PATH in OLD_PATH
set OLD_PATH=%USER_PATH%
rem Update this processes PATH to have node dir (this WILL NOT persist outside this process which is a problem for NPM run scripts we use)
set PATH=%NODE_DIR%;%PATH%
set PATH_LENGTH=0
for %%A in ("%NODE_DIR%;%OLD_PATH%") do set "PATH_LENGTH=%%~zA"

IF !PATH_LENGTH! GTR 1024 (
echo "Your PATH is greater than 1024 characters, cmd setx cannot change it. Either shorten your user's PATH contents or hope you have NodeJS in your PATH already..."
) else (
rem Set new user PATH for all processes
setx PATH "%NODE_DIR%;%OLD_PATH%" >NUL
set PATH_NEEDS_RESTORE=1
)

IF "%FORCE_BUILD%"=="1" (
rem We could replace this all with a single npm script that does all this. we do have several build-all scripts already
Expand Down Expand Up @@ -211,11 +193,6 @@ IF "%FORCE_BUILD%"=="1" (
echo Skipping rebuilding frontend... %FRONTEND_DIR% has content already, use --build to force a frontend rebuild.
)

IF "%PATH_NEEDS_RESTORE%"=="1" (
rem Restore PATH
setx PATH "%OLD_PATH%" >NUL
)

exit /b

:SetupCoturn
Expand Down

0 comments on commit 635a68b

Please sign in to comment.