aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brendan Taylor <whateley@gmail.com>2010-11-21 22:43:14 -0700
committerGravatar Brendan Taylor <whateley@gmail.com>2010-11-21 22:43:14 -0700
commitf140884503c05d20bbd88114a1f1f10b6de067ef (patch)
treea7102e344c6370af9f4f16befa5ec9693a31c0e9
parent8b349cd89eab4003eb558e98d2bde7bb95e71f4a (diff)
uzbl-browser: quote paths properly
-rwxr-xr-xsrc/uzbl-browser38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/uzbl-browser b/src/uzbl-browser
index 1b7abe7..9756ed1 100755
--- a/src/uzbl-browser
+++ b/src/uzbl-browser
@@ -8,27 +8,22 @@
# to your $XDG_DATA_HOME/uzbl/scripts/ and edit them
PREFIX=/usr/local
-if [ -z "$XDG_DATA_HOME" ]
-then
- export XDG_DATA_HOME=$HOME/.local/share
-fi
-if [ -z "$XDG_CACHE_HOME" ]
-then
- export XDG_CACHE_HOME=$HOME/.cache
-fi
+XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
+export XDG_DATA_HOME
-if [ -z "$XDG_CONFIG_HOME" ]
-then
- export XDG_CONFIG_HOME=$HOME/.config
-fi
+XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
+export XDG_CACHE_HOME
+
+XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
+export XDG_CONFIG_HOME
# assure the relevant directories exist.
-for dir in $XDG_CACHE_HOME/uzbl $XDG_DATA_HOME/uzbl $XDG_CONFIG_HOME/uzbl
+for dir in "$XDG_CACHE_HOME"/uzbl "$XDG_DATA_HOME"/uzbl "$XDG_CONFIG_HOME"/uzbl
do
- if [ ! -d $dir ]
+ if [ ! -d "$dir" ]
then
- if ! mkdir -p $dir
+ if ! mkdir -p "$dir"
then
echo "could not create $dir" >&2
exit 2
@@ -37,18 +32,19 @@ do
done
# if no config exists yet in the recommended location, put the default (recommended) config there
-if [ ! -f $XDG_CONFIG_HOME/uzbl/config ]
+if [ ! -f "$XDG_CONFIG_HOME"/uzbl/config ]
then
- if [ ! -r $PREFIX/share/uzbl/examples/config/config ]
+ global_config=$PREFIX/share/uzbl/examples/config/config
+ if [ ! -r "$global_config" ]
then
echo "Error: Global config not found; please check if your distribution ships them separately"
exit 3
fi
- if ! cp $PREFIX/share/uzbl/examples/config/config $XDG_CONFIG_HOME/uzbl/config
+ if ! cp "$global_config" "$XDG_CONFIG_HOME"/uzbl/config
then
echo "Could not copy default config to $XDG_CONFIG_HOME/uzbl/config" >&2
- # Run with the global configs as a last resort
- config="--config $PREFIX/share/uzbl/examples/config/config"
+ # Run with the global config as a last resort
+ config_file=$global_config
fi
fi
@@ -67,4 +63,4 @@ DAEMON_SOCKET="$XDG_CACHE_HOME"/uzbl/event_daemon
${UZBL_EVENT_MANAGER:-uzbl-event-manager -va start}
#fi
-exec uzbl-core "$@" $config --connect-socket $DAEMON_SOCKET
+exec uzbl-core "$@" ${config_file:+--config "$config_file"} --connect-socket $DAEMON_SOCKET