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

fix conditional where tilde (~) was not properly expanding to user's home directory

This commit is contained in:
William Ting 2012-03-14 12:54:48 -10:00
parent 23ecda6bae
commit 448696ef9b

View File

@ -15,32 +15,31 @@
#along with autojump. If not, see <http://www.gnu.org/licenses/>. #along with autojump. If not, see <http://www.gnu.org/licenses/>.
# determine the data directory according to the XDG Base Directory Specification # determine the data directory according to the XDG Base Directory Specification
if [ -n "${XDG_DATA_HOME}" ]; then if [[ -n ${XDG_DATA_HOME} ]]; then
export AUTOJUMP_DATA_DIR="${XDG_DATA_HOME}/autojump" export AUTOJUMP_DATA_DIR="${XDG_DATA_HOME}/autojump"
else else
export AUTOJUMP_DATA_DIR=~/.local/share/autojump export AUTOJUMP_DATA_DIR=${HOME}/.local/share/autojump
fi fi
if [ ! -e "${AUTOJUMP_DATA_DIR}" ]; then if [[ ! -e ${AUTOJUMP_DATA_DIR} ]]; then
mkdir -p "${AUTOJUMP_DATA_DIR}" mkdir -p "${AUTOJUMP_DATA_DIR}"
mv ~/.autojump_py "${AUTOJUMP_DATA_DIR}/autojump_py" 2>>/dev/null #migration mv ${HOME}/.autojump_py "${AUTOJUMP_DATA_DIR}/autojump_py" 2>>/dev/null #migration
mv ~/.autojump_py.bak "${AUTOJUMP_DATA_DIR}/autojump_py.bak" 2>>/dev/null mv ${HOME}/.autojump_py.bak "${AUTOJUMP_DATA_DIR}/autojump_py.bak" 2>>/dev/null
mv ~/.autojump_errors "${AUTOJUMP_DATA_DIR}/autojump_errors" 2>>/dev/null mv ${HOME}/.autojump_errors "${AUTOJUMP_DATA_DIR}/autojump_errors" 2>>/dev/null
fi fi
# set paths if necessary for local installations # set paths if necessary for local installations
if [[ -d "~/.autojump/" ]]; then if [[ -d ${HOME}/.autojump ]]; then
path=(~/.autojump/bin $path) path=(${HOME}/.autojump/bin ${path})
fpath=(~/.autojump/functions/ $fpath) fpath=(${HOME}/.autojump/functions/ ${fpath})
fi fi
# set fpath if necessary for homebrew installation # set fpath if necessary for homebrew installation
if [ -d "`brew --prefix 2>/dev/null`/share/zsh/functions" ]; then if [[ -d "`brew --prefix 2>/dev/null`/share/zsh/functions" ]]; then
fpath=(`brew --prefix`/share/zsh/functions $fpath) fpath=(`brew --prefix`/share/zsh/functions ${fpath})
fi fi
function autojump_preexec() { function autojump_preexec() {
if [[ "${AUTOJUMP_KEEP_SYMLINKS}" == "1" ]] if [[ "${AUTOJUMP_KEEP_SYMLINKS}" == "1" ]]; then
then
_PWD_ARGS="" _PWD_ARGS=""
else else
_PWD_ARGS="-P" _PWD_ARGS="-P"