Merge remote-tracking branch 'xiaonaitong/master' into windows

pull/75/head
Joël Schaerer 13 years ago
commit 4e3d55f9d0

@ -77,9 +77,9 @@ def unico(text):
def save(path_dict, dic_file):
"""Save the database in an atomic way, and preserve
a backup file."""
# If the dic_file exists, check that it belongs to us
# If the dic_file exists and os is not windows, check that it belongs to us
# Otherwise, fail quietly
if (not os.path.exists(dic_file)) or os.getuid() == os.stat(dic_file)[4]:
if (not os.path.exists(dic_file)) or os.name == 'nt' or os.getuid() == os.stat(dic_file)[4]:
temp = NamedTemporaryFile(dir=CONFIG_DIR, delete=False)
for path,weight in sorted(path_dict.items(),key=itemgetter(1),reverse=True):
# the db is stored in utf-8
@ -88,7 +88,8 @@ def save(path_dict, dic_file):
os.fsync(temp)
temp.close()
#cf. http://thunk.org/tytso/blog/2009/03/15/dont-fear-the-fsync/
os.rename(temp.name, dic_file)
import shutil
shutil.move(temp.name, dic_file)
try: #backup file
import time
if (not os.path.exists(dic_file+".bak") or

@ -19,10 +19,13 @@ _autojump()
{
local cur
cur=${COMP_WORDS[*]:1}
comps=$(autojump --bash --completion $cur)
while read i
do
COMPREPLY=("${COMPREPLY[@]}" "${i}")
done < <(autojump --bash --completion $cur)
done <<EOF
$comps
EOF
}
complete -F _autojump j
@ -43,9 +46,12 @@ then
fi
export AUTOJUMP_HOME=${HOME}
AUTOJUMP='{ [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd -P)"&)>/dev/null 2>>${AUTOJUMP_DATA_DIR}/.autojump_errors;} 2>/dev/null'
if [[ ! $PROMPT_COMMAND =~ autojump ]]; then
export PROMPT_COMMAND="$AUTOJUMP ; ${PROMPT_COMMAND:-:}"
fi
AUTOJUMP='{ [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd -P)"&)>/dev/null 2>>"${AUTOJUMP_DATA_DIR}/.autojump_errors";} 2>/dev/null'
case $PROMPT_COMMAND in
*autojump*) ;;
*) export PROMPT_COMMAND="$AUTOJUMP ; ${PROMPT_COMMAND:-:}";;
esac
alias jumpstat="autojump --stat"
function j { new_path="$(autojump $@)";if [ -n "$new_path" ]; then echo -e "\\033[31m${new_path}\\033[0m"; cd "$new_path";else false; fi }

@ -44,17 +44,17 @@ echo "Installing to ${prefix} ..."
./git-version.sh
# INSTALL AUTOJUMP
sudo mkdir -p ${prefix}/share/autojump/
sudo mkdir -p ${prefix}/bin/
sudo mkdir -p ${prefix}/share/man/man1/
sudo cp icon.png ${prefix}/share/autojump/
sudo cp jumpapplet ${prefix}/bin/
sudo cp autojump ${prefix}/bin/
sudo cp autojump.1 ${prefix}/share/man/man1/
mkdir -p ${prefix}/share/autojump/
mkdir -p ${prefix}/bin/
mkdir -p ${prefix}/share/man/man1/
cp icon.png ${prefix}/share/autojump/
cp jumpapplet ${prefix}/bin/
cp autojump ${prefix}/bin/
cp autojump.1 ${prefix}/share/man/man1/
if [ -d "/etc/profile.d" ]; then
sudo cp autojump.bash /etc/profile.d/
sudo cp autojump.sh /etc/profile.d/
cp autojump.bash /etc/profile.d/
cp autojump.sh /etc/profile.d/
# Make sure that the code we just copied has been sourced.
# check if .bashrc has sourced /etc/profile or /etc/profile.d/autojump.bash

Loading…
Cancel
Save