mirror of
https://github.com/cmderdev/cmder.git
synced 2025-11-08 05:09:02 +08:00
avoid temp filename collisions
This commit is contained in:
6
vendor/lib/lib_path.cmd
vendored
6
vendor/lib/lib_path.cmd
vendored
@@ -128,8 +128,14 @@ exit /b
|
|||||||
|
|
||||||
:toolong
|
:toolong
|
||||||
set "_rand=%RANDOM%"
|
set "_rand=%RANDOM%"
|
||||||
|
if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" 2>nul 1>nul
|
||||||
|
if exist "%temp%\%_rand%_cmder_lib_pathB" del "%temp%\%_rand%_cmder_lib_pathB" 2>nul 1>nul
|
||||||
|
if exist "%temp%\%_rand%_cmder_lib_pathA" goto :toolong
|
||||||
|
if exist "%temp%\%_rand%_cmder_lib_pathB" goto :toolong
|
||||||
echo "%OLD_PATH%">"%temp%\%_rand%_cmder_lib_pathA"
|
echo "%OLD_PATH%">"%temp%\%_rand%_cmder_lib_pathA"
|
||||||
|
if errorlevel 1 ( if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" & goto :toolong )
|
||||||
echo "%PATH%">"%temp%\%_rand%_cmder_lib_pathB"
|
echo "%PATH%">"%temp%\%_rand%_cmder_lib_pathB"
|
||||||
|
if errorlevel 1 ( if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" & if exist "%temp%\%_cmder_lib_pathB" del "%temp%\%_rand%_cmder_lib_pathB" & goto :toolong )
|
||||||
fc /b "%temp%\%_rand%_cmder_lib_pathA" "%temp%\%_rand%_cmder_lib_pathB" 2>nul 1>nul
|
fc /b "%temp%\%_rand%_cmder_lib_pathA" "%temp%\%_rand%_cmder_lib_pathB" 2>nul 1>nul
|
||||||
if errorlevel 1 ( del "%temp%\%_rand%_cmder_lib_pathA" & del "%temp%\%_rand%_cmder_lib_pathB" & set "_rand=" & goto :changed )
|
if errorlevel 1 ( del "%temp%\%_rand%_cmder_lib_pathA" & del "%temp%\%_rand%_cmder_lib_pathB" & set "_rand=" & goto :changed )
|
||||||
del "%temp%\%_rand%_cmder_lib_pathA" & del "%temp%\%_rand%_cmder_lib_pathB" & set "_rand="
|
del "%temp%\%_rand%_cmder_lib_pathA" & del "%temp%\%_rand%_cmder_lib_pathB" & set "_rand="
|
||||||
|
|||||||
Reference in New Issue
Block a user