aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl-core.c
diff options
context:
space:
mode:
authorGravatar Robert Manea <gotmor@gmail.com>2009-09-25 14:56:06 +0200
committerGravatar Robert Manea <gotmor@gmail.com>2009-09-25 14:56:06 +0200
commit6e1cc08c25c65b46fb957067fef5b5fcc61e0e91 (patch)
tree8dccb0e4adf32b6e84e8020eb755f62c7b19e5ff /uzbl-core.c
parent7d709711a2036bdfa27d894fdbbe24e8454e204e (diff)
added PATH ability to the script command
Diffstat (limited to 'uzbl-core.c')
-rw-r--r--uzbl-core.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/uzbl-core.c b/uzbl-core.c
index e69873f..4dc6ae9 100644
--- a/uzbl-core.c
+++ b/uzbl-core.c
@@ -527,7 +527,6 @@ read_file_by_line (const gchar *path) {
int i = 0;
chan = g_io_channel_new_file(path, "r", NULL);
-
if (chan) {
while (g_io_channel_read_line(chan, &readbuf, &len, NULL, NULL) == G_IO_STATUS_NORMAL) {
const gchar* val = g_strdup (readbuf);
@@ -1271,8 +1270,11 @@ run_js (WebKitWebView * web_view, GArray *argv, GString *result) {
void
run_external_js (WebKitWebView * web_view, GArray *argv, GString *result) {
(void) result;
- if (argv_idx(argv, 0)) {
- GArray* lines = read_file_by_line (argv_idx (argv, 0));
+ gchar *path = NULL;
+
+ if (argv_idx(argv, 0) &&
+ ((path = find_existing_file(argv_idx(argv, 0)))) ) {
+ GArray* lines = read_file_by_line (path);
gchar* js = NULL;
int i = 0;
gchar* line;
@@ -1299,6 +1301,7 @@ run_external_js (WebKitWebView * web_view, GArray *argv, GString *result) {
eval_js (web_view, js, result);
g_free (js);
g_array_free (lines, TRUE);
+ g_free(path);
}
}