Merge pull request #381 from ElArtista/master

Handling of directories with spaces in Windows and portability fixes.
pull/412/merge
William Ting 8 years ago committed by GitHub
commit 0bce510c7e

@ -1,2 +1,2 @@
@echo off
python %~dp0\autojump %*
python "%~dp0\autojump" %*

@ -1,13 +1,15 @@
local AUTOJUMP_DIR = debug.getinfo(1, "S").source:match[[^@?(.*[\/])[^\/]-$]] .. "..\\AutoJump"
local AUTOJUMP_BIN_DIR = AUTOJUMP_DIR .. "\\bin"
local AUTOJUMP_BIN = (AUTOJUMP_BIN_DIR or clink.get_env("LOCALAPPDATA") .. "\\autojump\\bin") .. "\\autojump"
function autojump_add_to_database()
os.execute("python " .. AUTOJUMP_BIN .. " --add " .. clink.get_cwd() .. " 2> " .. clink.get_env("TEMP") .. "\\autojump_error.txt")
os.execute("python " .. "\"" .. AUTOJUMP_BIN .. "\"" .. " --add " .. "\"" .. clink.get_cwd() .. "\"" .. " 2> " .. clink.get_env("TEMP") .. "\\autojump_error.txt")
end
clink.prompt.register_filter(autojump_add_to_database, 99)
function autojump_completion(word)
for line in io.popen("python " .. AUTOJUMP_BIN .. " --complete " .. word):lines() do
for line in io.popen("python " .. "\"" .. AUTOJUMP_BIN .. "\"" .. " --complete " .. word):lines() do
clink.add_match(line)
end
return {}

@ -3,7 +3,7 @@ setlocal EnableDelayedExpansion
echo %*|>nul findstr /rx \-.*
if ERRORLEVEL 1 (
for /f %%i in ('python %~dp0\autojump %*') do set new_path=%%i
for /f %%i in ('python "%~dp0\autojump" %*') do set new_path=%%i
if exist !new_path!\nul (
echo !new_path!
pushd !new_path!
@ -17,5 +17,5 @@ if ERRORLEVEL 1 (
echo try `autojump --help` for more information
)
) else (
python %~dp0\autojump %*
)
python "%~dp0\autojump" %*
)

@ -2,7 +2,7 @@
echo %*|>nul findstr /rx \-.*
if ERRORLEVEL 1 (
%~dp0\j.bat %cd% %*
"%~dp0\j.bat" "%cd%" %*
) else (
python %~dp0\autojump %*
python "%~dp0\autojump" %*
)

@ -2,7 +2,7 @@
echo %*|>nul findstr /rx \-.*
if ERRORLEVEL 1 (
%~dp0\jc.bat %cd% %*
"%~dp0\jc.bat" "%cd%" %*
) else (
python %~dp0\autojump %*
python "%~dp0\autojump" %*
)

@ -3,7 +3,7 @@ setlocal EnableDelayedExpansion
echo %*|>nul findstr /rx \-.*
if ERRORLEVEL 1 (
for /f %%i in ('python %~dp0\autojump %*') do set new_path=%%i
for /f %%i in ('python "%~dp0\autojump" %*') do set new_path=%%i
if exist !new_path!\nul (
start !new_path!
) else (
@ -11,5 +11,5 @@ if ERRORLEVEL 1 (
echo try `autojump --help` for more information
)
) else (
python %~dp0\autojump %*
python "%~dp0\autojump" %*
)
Loading…
Cancel
Save