diff --git a/bin/autojump.bat b/bin/autojump.bat index a9e359a..a8cfb8f 100644 --- a/bin/autojump.bat +++ b/bin/autojump.bat @@ -1,2 +1,2 @@ @echo off -python %~dp0\autojump %* \ No newline at end of file +python "%~dp0\autojump" %* diff --git a/bin/autojump.lua b/bin/autojump.lua index 37422e8..591b55d 100644 --- a/bin/autojump.lua +++ b/bin/autojump.lua @@ -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 {} diff --git a/bin/j.bat b/bin/j.bat index 77925c9..a4bfeea 100644 --- a/bin/j.bat +++ b/bin/j.bat @@ -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 %* -) \ No newline at end of file + python "%~dp0\autojump" %* +) diff --git a/bin/jc.bat b/bin/jc.bat index f0cc8db..ace52f6 100644 --- a/bin/jc.bat +++ b/bin/jc.bat @@ -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" %* ) \ No newline at end of file diff --git a/bin/jco.bat b/bin/jco.bat index efd42ff..937c839 100644 --- a/bin/jco.bat +++ b/bin/jco.bat @@ -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" %* ) \ No newline at end of file diff --git a/bin/jo.bat b/bin/jo.bat index 1bb2485..34fe243 100644 --- a/bin/jo.bat +++ b/bin/jo.bat @@ -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" %* ) \ No newline at end of file