aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brendan Taylor <whateley@gmail.com>2010-11-21 23:15:02 -0700
committerGravatar Brendan Taylor <whateley@gmail.com>2010-11-21 23:21:28 -0700
commite660b9de3f4331ebf171735b40eb12105218b2d7 (patch)
tree56b13fa90303205fd1a8bc1c36b75a23ee8305b7
parentbb1153c9bc776d0c0dde44bcc055d40c7617a998 (diff)
set UZBL_UTIL_DIR in uzbl-browser, get rid of the scripts_util_dir variable
-rw-r--r--examples/config/config1
-rwxr-xr-xsrc/uzbl-browser18
-rw-r--r--src/uzbl-core.c27
-rw-r--r--src/uzbl-core.h3
4 files changed, 17 insertions, 32 deletions
diff --git a/examples/config/config b/examples/config/config
index 847b4af..1457c71 100644
--- a/examples/config/config
+++ b/examples/config/config
@@ -35,7 +35,6 @@ set set_status = set status_message =
# Spawn path shortcuts. In spawn the first dir+path match is used in "dir1:dir2:dir3:executable"
set scripts_dir = $XDG_DATA_HOME/uzbl:@prefix/share/uzbl/examples/data:scripts
-set scripts_util_dir = @scripts_dir/util
# === Hardcoded handlers =====================================================
diff --git a/src/uzbl-browser b/src/uzbl-browser
index de4f7af..865447c 100755
--- a/src/uzbl-browser
+++ b/src/uzbl-browser
@@ -10,6 +10,8 @@
# But this shouldn't cause much problems..
PREFIX=/usr/local
+EXAMPLES=$PREFIX/share/uzbl/examples
+
if [ -z "$XDG_DATA_HOME" ]
then
export XDG_DATA_HOME=$HOME/.local/share
@@ -40,13 +42,27 @@ done
# if no config exists yet in the recommended location, put the default (recommended) config there
if [ ! -f $XDG_CONFIG_HOME/uzbl/config ]
then
- if ! cp $PREFIX/share/uzbl/examples/config/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
exit 3
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
+
# Uncomment this for a slight speedup at the expense of not having
# stale cookie daemon sockets cleaned up.
#if [ ! -S $XDG_CACHE_HOME/uzbl/cookie_daemon_socket ]
diff --git a/src/uzbl-core.c b/src/uzbl-core.c
index 13328d0..fd589c0 100644
--- a/src/uzbl-core.c
+++ b/src/uzbl-core.c
@@ -1263,29 +1263,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,
@@ -1297,7 +1274,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 */
@@ -1337,9 +1313,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 15f7299..5760423 100644
--- a/src/uzbl-core.h
+++ b/src/uzbl-core.h
@@ -274,9 +274,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);