From d3dd3f34e6ec1d027e050cf52e51ccbc7737fb5c Mon Sep 17 00:00:00 2001 From: TheArtist Date: Fri, 11 Sep 2015 17:41:23 +0300 Subject: [PATCH 1/3] Fixed handling of directories with spaces on Windows --- bin/autojump.bat | 2 +- bin/j.bat | 2 +- bin/jc.bat | 4 ++-- bin/jco.bat | 4 ++-- bin/jo.bat | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) 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/j.bat b/bin/j.bat index 77925c9..dbbaec8 100644 --- a/bin/j.bat +++ b/bin/j.bat @@ -17,5 +17,5 @@ if ERRORLEVEL 1 ( echo try `autojump --help` for more information ) ) else ( - python %~dp0\autojump %* + python "%~dp0\autojump" %* ) \ No newline at end of file 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..27f5b7b 100644 --- a/bin/jo.bat +++ b/bin/jo.bat @@ -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 From b71612eea4649fbdbce33002fb4096de2dbf0c7d Mon Sep 17 00:00:00 2001 From: TheArtist Date: Fri, 11 Sep 2015 19:36:36 +0300 Subject: [PATCH 2/3] More handling for directory with spaces on Windows --- bin/j.bat | 4 ++-- bin/jo.bat | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/j.bat b/bin/j.bat index dbbaec8..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! @@ -18,4 +18,4 @@ if ERRORLEVEL 1 ( ) ) else ( python "%~dp0\autojump" %* -) \ No newline at end of file +) diff --git a/bin/jo.bat b/bin/jo.bat index 27f5b7b..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 ( From 3e5cec67b995c61e8724ba8fe28cb0dd3469cd4c Mon Sep 17 00:00:00 2001 From: TheArtist Date: Fri, 11 Sep 2015 19:37:39 +0300 Subject: [PATCH 3/3] Autojump lua script portability fix --- bin/autojump.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 {}