Skip to content

Commit

Permalink
fix conditional where tilde (~) was not properly expanding to user's …
Browse files Browse the repository at this point in the history
…home directory
  • Loading branch information
wting committed Mar 14, 2012
1 parent 23ecda6 commit 448696e
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions autojump.zsh
Expand Up @@ -15,32 +15,31 @@
#along with autojump. If not, see <http://www.gnu.org/licenses/>.

# 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"
else
export AUTOJUMP_DATA_DIR=~/.local/share/autojump
export AUTOJUMP_DATA_DIR=${HOME}/.local/share/autojump
fi

if [ ! -e "${AUTOJUMP_DATA_DIR}" ]; then
if [[ ! -e ${AUTOJUMP_DATA_DIR} ]]; then
mkdir -p "${AUTOJUMP_DATA_DIR}"
mv ~/.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 ~/.autojump_errors "${AUTOJUMP_DATA_DIR}/autojump_errors" 2>>/dev/null
mv ${HOME}/.autojump_py "${AUTOJUMP_DATA_DIR}/autojump_py" 2>>/dev/null #migration
mv ${HOME}/.autojump_py.bak "${AUTOJUMP_DATA_DIR}/autojump_py.bak" 2>>/dev/null
mv ${HOME}/.autojump_errors "${AUTOJUMP_DATA_DIR}/autojump_errors" 2>>/dev/null
fi

# set paths if necessary for local installations
if [[ -d "~/.autojump/" ]]; then
path=(~/.autojump/bin $path)
fpath=(~/.autojump/functions/ $fpath)
if [[ -d ${HOME}/.autojump ]]; then
path=(${HOME}/.autojump/bin ${path})
fpath=(${HOME}/.autojump/functions/ ${fpath})
fi
# set fpath if necessary for homebrew installation
if [ -d "`brew --prefix 2>/dev/null`/share/zsh/functions" ]; then
fpath=(`brew --prefix`/share/zsh/functions $fpath)
if [[ -d "`brew --prefix 2>/dev/null`/share/zsh/functions" ]]; then
fpath=(`brew --prefix`/share/zsh/functions ${fpath})
fi

function autojump_preexec() {
if [[ "${AUTOJUMP_KEEP_SYMLINKS}" == "1" ]]
then
if [[ "${AUTOJUMP_KEEP_SYMLINKS}" == "1" ]]; then
_PWD_ARGS=""
else
_PWD_ARGS="-P"
Expand Down

0 comments on commit 448696e

Please sign in to comment.