Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion z.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ for /f "delims=" %%i in ('cd') do set "PWD=%%i"

if /i "%RunMode%"=="-n" (
for /f "delims=" %%i in ('call "%LuaExe%" "%LuaScript%" --cd %MatchType% %StrictSub% %InterMode% %*') do set "NewPath=%%i"
if "!NewPath!"=="" (
set NewPath=%1
call :normalizepath !NewPath!
set NewPath=!retval!
)
if not "!NewPath!"=="" (
if exist !NewPath!\nul (
if /i not "%_ZL_ECHO%"=="" (
Expand All @@ -121,8 +126,16 @@ rem -- directory without leaking a pushd.
popd
setlocal
set NewPath=%CD%
endlocal & popd & cd /d "%NewPath%"
set "CDCmd=cd /d"
if /i not "%_ZL_CD%"=="" (
set "CDCmd=%_ZL_CD%"
)
endlocal & popd & %CDCmd% "%NewPath%"

:end
echo.
exit /B

:normalizepath
set retval=%~f1
exit /B
15 changes: 14 additions & 1 deletion z.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2544,6 +2544,11 @@ if /i "%1"=="" (
for /f "delims=" %%i in ('cd') do set "PWD=%%i"
if /i "%RunMode%"=="-n" (
for /f "delims=" %%i in ('call "%LuaExe%" "%LuaScript%" --cd %MatchType% %StrictSub% %InterMode% %*') do set "NewPath=%%i"
if "!NewPath!"=="" (
set NewPath=%1
call :normalizepath !NewPath!
set NewPath=!retval!
)
if not "!NewPath!"=="" (
if exist !NewPath!\nul (
if /i not "%_ZL_ECHO%"=="" (
Expand All @@ -2563,8 +2568,16 @@ goto end
popd
setlocal
set "NewPath=%CD%"
endlocal & popd & cd /d "%NewPath%"
set "CDCmd=cd /d"
if /i not "%_ZL_CD%"=="" (
set "CDCmd=%_ZL_CD%"
)
endlocal & popd & %CDCmd% "%NewPath%"
:end
exit /B
:normalizepath
set retval=%~f1
exit /B
]]


Expand Down