1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

Fix jumping to paths containing spaces on Windows.

This commit is contained in:
Moritz Flucht 2016-10-07 15:18:03 +02:00 committed by William Ting
parent 865476ed56
commit b0bc534838
2 changed files with 9 additions and 9 deletions

View File

@ -3,15 +3,15 @@ setlocal EnableDelayedExpansion
echo %*|>nul findstr /rx \-.* echo %*|>nul findstr /rx \-.*
if ERRORLEVEL 1 ( if ERRORLEVEL 1 (
for /f %%i in ('python "%~dp0\autojump" %*') do set new_path=%%i for /f "delims=" %%i in ('python "%~dp0\autojump" %*') do set new_path=%%i
if exist !new_path!\nul ( if exist !new_path!\nul (
echo !new_path! echo !new_path!
pushd !new_path! pushd !new_path!
REM endlocal is necessary so that we can change directory for outside of this script REM endlocal is necessary so that we can change directory for outside of this script
REM but will automatically popd. We mush pushd twice to work around this. REM but will automatically popd. We mush pushd twice to work around this.
pushd !new_path! pushd !new_path!
endlocal endlocal
popd popd
) else ( ) else (
echo autojump: directory %* not found echo autojump: directory %* not found
echo try `autojump --help` for more information echo try `autojump --help` for more information

View File

@ -3,9 +3,9 @@ setlocal EnableDelayedExpansion
echo %*|>nul findstr /rx \-.* echo %*|>nul findstr /rx \-.*
if ERRORLEVEL 1 ( if ERRORLEVEL 1 (
for /f %%i in ('python "%~dp0\autojump" %*') do set new_path=%%i for /f "delims=" %%i in ('python "%~dp0\autojump" %*') do set new_path=%%i
if exist !new_path!\nul ( if exist !new_path!\nul (
start !new_path! start "" "explorer" !new_path!
) else ( ) else (
echo autojump: directory %* not found echo autojump: directory %* not found
echo try `autojump --help` for more information echo try `autojump --help` for more information