diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2010-03-31 13:59:57 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2010-03-31 13:59:57 +0000 |
commit | 95e4a737de53dc2f02a2db95b26151d9d494bc0c (patch) | |
tree | a9dcb06c696a463f824d61865fb46d6a7bfa755b /windows/findfile.c | |
parent | 9f575c590b3c304ab02707ee3378bd2e4f4c9094 (diff) | |
download | netsurf-95e4a737de53dc2f02a2db95b26151d9d494bc0c.tar.gz netsurf-95e4a737de53dc2f02a2db95b26151d9d494bc0c.tar.bz2 |
rationalise the usage of the file scheme
svn path=/trunk/netsurf/; revision=10221
Diffstat (limited to 'windows/findfile.c')
-rw-r--r-- | windows/findfile.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/windows/findfile.c b/windows/findfile.c index f47e49d03..c3e613d3a 100644 --- a/windows/findfile.c +++ b/windows/findfile.c @@ -24,6 +24,7 @@ #include <stdlib.h> #include <string.h> +#include "utils/url.h" #include "utils/log.h" #include "utils/utils.h" @@ -37,12 +38,19 @@ static char *realpath(const char *path, char *resolved_path) char *path_to_url(const char *path) { - char *r = malloc(strlen(path) + 7 + 1); + char *url = malloc(strlen(path) + FILE_SCHEME_PREFIX_LEN + 1); + char *sidx; - strcpy(r, "file://"); - strcat(r, path); + strcpy(url, FILE_SCHEME_PREFIX); + strcat(url, path); - return r; + sidx = strrchr(url, '\\'); + while (sidx != NULL) { + *sidx = '/'; + sidx = strrchr(url, '\\'); + } + + return url; } /** |