diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-05-26 23:43:36 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-05-26 23:52:36 +0100 |
commit | 00b6cfc57e27f8146d9b41ba8e63038a4f9df70e (patch) | |
tree | badf71a43a81975098d3f1294073d8c76bc994ea /windows/findfile.c | |
parent | 1f337f292d1c98c396d5f8d5d294f9ba13963586 (diff) | |
download | netsurf-00b6cfc57e27f8146d9b41ba8e63038a4f9df70e.tar.gz netsurf-00b6cfc57e27f8146d9b41ba8e63038a4f9df70e.tar.bz2 |
rework path to url mapping functions to convert from and to nsurl
Diffstat (limited to 'windows/findfile.c')
-rw-r--r-- | windows/findfile.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/windows/findfile.c b/windows/findfile.c index 4862b4476..51ce74829 100644 --- a/windows/findfile.c +++ b/windows/findfile.c @@ -82,61 +82,6 @@ static char *realpath(const char *path, char *resolved_path) return strncpy(resolved_path, path, PATH_MAX); } -char *path_to_url(const char *path) -{ - char *url; - char *sidx; - - if (path == NULL) - return NULL; - - url = malloc(strlen(path) + FILE_SCHEME_PREFIX_LEN + 3); - - if (url == NULL) - return NULL; - - strcpy(url, FILE_SCHEME_PREFIX); - if (*path == '/') { - /* unix style path start, so try wine Z: */ - strcat(url, "Z:"); - } - strcat(url, path); - - sidx = strrchr(url, '\\'); - while (sidx != NULL) { - *sidx = '/'; - sidx = strrchr(url, '\\'); - } - - return url; -} - - -char *url_to_path(const char *url) -{ - char *url_path = curl_unescape(url, 0); - char *path; - char *sidx; - - if ((url_path[FILE_SCHEME_PREFIX_LEN + 1] == ':') || - (url_path[FILE_SCHEME_PREFIX_LEN + 1] == '|')) { - /* url_path contains a drive: prefix */ - path = strdup(url_path + FILE_SCHEME_PREFIX_LEN); - - /* swap / for \ */ - sidx = strrchr(path, '/'); - while (sidx != NULL) { - *sidx = '\\'; - sidx = strrchr(path, '/'); - } - } else { - /* return the absolute path including leading / */ - path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN - 1)); - } - curl_free(url_path); - - return path; -} /** * Locate a shared resource file by searching known places in order. |