diff options
author | Brendan Taylor <whateley@gmail.com> | 2010-11-21 23:25:17 -0700 |
---|---|---|
committer | Brendan Taylor <whateley@gmail.com> | 2010-11-21 23:25:17 -0700 |
commit | 2fbd3ecfd2697f5883228c1ff8ddae65a5e48322 (patch) | |
tree | 5340c0d3912c2cda2b5d481070d86bd4b61652df /src | |
parent | f140884503c05d20bbd88114a1f1f10b6de067ef (diff) | |
parent | e660b9de3f4331ebf171735b40eb12105218b2d7 (diff) |
Merge branch 'dev/cleanup-scripts'
Conflicts:
src/uzbl-browser
Diffstat (limited to 'src')
-rwxr-xr-x | src/uzbl-browser | 22 | ||||
-rw-r--r-- | src/uzbl-core.c | 27 | ||||
-rw-r--r-- | src/uzbl-core.h | 3 |
3 files changed, 18 insertions, 34 deletions
diff --git a/src/uzbl-browser b/src/uzbl-browser index 9756ed1..88d3742 100755 --- a/src/uzbl-browser +++ b/src/uzbl-browser @@ -8,6 +8,7 @@ # to your $XDG_DATA_HOME/uzbl/scripts/ and edit them PREFIX=/usr/local +EXAMPLES=$PREFIX/share/uzbl/examples XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share} export XDG_DATA_HOME @@ -34,20 +35,33 @@ done # if no config exists yet in the recommended location, put the default (recommended) config there if [ ! -f "$XDG_CONFIG_HOME"/uzbl/config ] then - global_config=$PREFIX/share/uzbl/examples/config/config - if [ ! -r "$global_config" ] + if [ ! -r "$EXAMPLES"/config/config ] then echo "Error: Global config not found; please check if your distribution ships them separately" exit 3 fi - if ! cp "$global_config" "$XDG_CONFIG_HOME"/uzbl/config + if ! cp "$EXAMPLES"/config/config "$XDG_CONFIG_HOME"/uzbl/config then echo "Could not copy default config to $XDG_CONFIG_HOME/uzbl/config" >&2 # Run with the global config as a last resort - config_file=$global_config + config_file=$EXAMPLES/config/config fi fi +# this variable is used by the default helper scripts as a location to +# load shared code from +if [ -z "$UZBL_UTIL_DIR" ] +then + if [ -d "$XDG_DATA_HOME"/uzbl/scripts/util ] + then + UZBL_UTIL_DIR=$XDG_DATA_HOME/uzbl/scripts/util + elif [ -d $EXAMPLES/data/scripts/util ] + then + UZBL_UTIL_DIR=$EXAMPLES/data/scripts/util + fi + export UZBL_UTIL_DIR +fi + # uzbl-cookie-manager will exit if another instance is already running. # we could also check if its pid file exists to avoid having to spawn it. #if [ ! -f "$XDG_CACHE_HOME"/uzbl/cookie_daemon_socket.pid ] diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 7e1d31b..cb20fd7 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -1209,29 +1209,6 @@ sharg_append(GArray *a, const gchar *str) { g_array_append_val(a, s); } -gboolean -uzbl_setup_environ() { - gchar *util_dirs = expand("@scripts_util_dir", 0); - gchar *util_dir = NULL; - gboolean succeed = FALSE; - - if(!util_dirs) { - g_free(util_dirs); - return succeed; - } - - if(!(util_dir = find_existing_file(util_dirs))) { - g_free(util_dirs); - return succeed; - } - - succeed = g_setenv("UZBL_UTIL_DIR", util_dir, TRUE); - - g_free(util_dirs); - g_free(util_dir); - return succeed; -} - // make sure that the args string you pass can properly be interpreted (eg properly escaped against whitespace, quotes etc) gboolean run_command (const gchar *command, const guint npre, const gchar **args, @@ -1243,7 +1220,6 @@ run_command (const gchar *command, const guint npre, const gchar **args, gchar *pid = itos(getpid()); gchar *xwin = itos(uzbl.xwin); guint i; - gboolean environ_set = uzbl_setup_environ(); sharg_append(a, command); for (i = 0; i < npre; i++) /* add n args before the default vars */ @@ -1283,9 +1259,6 @@ run_command (const gchar *command, const guint npre, const gchar **args, printf("Stdout: %s\n", *output_stdout); } } - if (!environ_set) { - g_printerr("failed to set the environment for scripts"); - } if (err) { g_printerr("error on run_command: %s\n", err->message); g_error_free (err); diff --git a/src/uzbl-core.h b/src/uzbl-core.h index 33dfb01..b5a502e 100644 --- a/src/uzbl-core.h +++ b/src/uzbl-core.h @@ -262,9 +262,6 @@ void close_uzbl (WebKitWebView *page, GArray *argv, GString *result); gboolean -uzbl_setup_environ(); - -gboolean run_command(const gchar *command, const guint npre, const gchar **args, const gboolean sync, char **output_stdout); |