aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Ben Boeckel <MathStuf@gmail.com>2010-10-02 12:57:27 -0400
committerGravatar Ben Boeckel <MathStuf@gmail.com>2010-10-02 13:31:34 -0400
commit7b8070d9997dc26d825467d3e78419d2ac51c985 (patch)
tree1cdfadc5830b150a934ffc56161d2e108d854319 /src
parent1fcdfb3a104b44d80300f77f31d6192c3560d8e7 (diff)
Set up the environment with the util dir
The new scripts require that the utility directory be set through the environment. Add a function which sets it up.
Diffstat (limited to 'src')
-rw-r--r--src/uzbl-core.c25
-rw-r--r--src/uzbl-core.h3
2 files changed, 28 insertions, 0 deletions
diff --git a/src/uzbl-core.c b/src/uzbl-core.c
index 7be98c3..129bb2a 100644
--- a/src/uzbl-core.c
+++ b/src/uzbl-core.c
@@ -1263,6 +1263,29 @@ 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,
@@ -1274,6 +1297,8 @@ 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 */
sharg_append(a, args[i]);
diff --git a/src/uzbl-core.h b/src/uzbl-core.h
index 5760423..15f7299 100644
--- a/src/uzbl-core.h
+++ b/src/uzbl-core.h
@@ -274,6 +274,9 @@ 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);