[dev] [surf] load file by relative name
This patch allows to specify a relative filename, and only
prepends 'file://' when it actually exists.
commit b8f02a8af106afc19d80ffb3c6e4be69fb7e2609
Author: Kurt Van Dijck <kurt_AT_vandijck-laurijssen.be>
Date: Thu Mar 14 11:45:34 2013
treat uri as file when it exists
Signed-off-by: Kurt Van Dijck <kurt_AT_vandijck-laurijssen.be>
diff --git a/surf.c b/surf.c
index 830665a..ac8d948 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -577,12 +577,13 @@ loaduri(Client *c, const Arg *arg) {
char *u, *rp;
const char *uri = (char *)arg->v;
Arg a = { .b = FALSE };
+ struct stat st;
if(strcmp(uri, "") == 0)
return;
/* In case it's a file path. */
- if(uri[0] == '/') {
+ if (stat(uri, &st) == 0) {
rp = realpath(uri, NULL);
u = g_strdup_printf("file://%s", rp);
free(rp);
Received on Thu Mar 14 2013 - 11:57:23 CET
This archive was generated by hypermail 2.3.0
: Thu Mar 14 2013 - 12:00:06 CET