aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl-core.c
diff options
context:
space:
mode:
authorGravatar Robert Manea <gotmor@gmail.com>2009-10-16 18:27:53 +0200
committerGravatar Robert Manea <gotmor@gmail.com>2009-10-16 18:27:53 +0200
commit6e1cdd5eef34745223212ec154f2c0ff56f1f88c (patch)
tree6c44f25cfe774681ee64fcbf32f6e58b456b8375 /uzbl-core.c
parent78161aa3c49bb264b2c539f85e689329d785d1fc (diff)
parentfdd8d07eba9e483baf618b6d8fd928fefb8465f3 (diff)
Merge branch 'experimental' of git://github.com/mason-larobina/uzbl into experimental
Diffstat (limited to 'uzbl-core.c')
-rw-r--r--uzbl-core.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/uzbl-core.c b/uzbl-core.c
index e3a3bc2..0e8c67f 100644
--- a/uzbl-core.c
+++ b/uzbl-core.c
@@ -730,8 +730,25 @@ load_uri (WebKitWebView *web_view, GArray *argv, GString *result) {
run_js(web_view, argv, NULL);
return;
}
- if (!soup_uri_new(argv_idx(argv, 0)))
- g_string_prepend (newuri, "http://");
+ if (!soup_uri_new(argv_idx(argv, 0))) {
+ GString* fullpath = g_string_new ("");
+ if (g_path_is_absolute (newuri->str))
+ g_string_assign (fullpath, newuri->str);
+ else {
+ gchar* wd;
+ wd = g_get_current_dir ();
+ g_string_assign (fullpath, g_build_filename (wd, newuri->str, NULL));
+ free(wd);
+ }
+ struct stat stat_result;
+ if (! g_stat(fullpath->str, &stat_result)) {
+ g_string_prepend (fullpath, "file://");
+ g_string_assign (newuri, fullpath->str);
+ }
+ else
+ g_string_prepend (newuri, "http://");
+ g_string_free (fullpath, TRUE);
+ }
/* if we do handle cookies, ask our handler for them */
webkit_web_view_load_uri (web_view, newuri->str);
g_string_free (newuri, TRUE);