summaryrefslogtreecommitdiff
path: root/cocoa
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-05-26 23:43:36 +0100
committerVincent Sanders <vince@kyllikki.org>2014-05-26 23:52:36 +0100
commit00b6cfc57e27f8146d9b41ba8e63038a4f9df70e (patch)
treebadf71a43a81975098d3f1294073d8c76bc994ea /cocoa
parent1f337f292d1c98c396d5f8d5d294f9ba13963586 (diff)
downloadnetsurf-00b6cfc57e27f8146d9b41ba8e63038a4f9df70e.tar.gz
netsurf-00b6cfc57e27f8146d9b41ba8e63038a4f9df70e.tar.bz2
rework path to url mapping functions to convert from and to nsurl
Diffstat (limited to 'cocoa')
-rw-r--r--cocoa/BrowserViewController.m12
-rw-r--r--cocoa/fetch.h2
-rw-r--r--cocoa/fetch.m14
3 files changed, 3 insertions, 25 deletions
diff --git a/cocoa/BrowserViewController.m b/cocoa/BrowserViewController.m
index b4e436063..f1b25d9d0 100644
--- a/cocoa/BrowserViewController.m
+++ b/cocoa/BrowserViewController.m
@@ -28,6 +28,7 @@
#import "utils/corestrings.h"
#import "utils/filename.h"
+#import "utils/file.h"
#import "utils/messages.h"
#import "utils/url.h"
#import "content/hlcache.h"
@@ -166,7 +167,7 @@
struct hlcache_handle *content;
size_t size;
const char *source;
- const char *path = NULL;
+ char *path = NULL;
if (browser == NULL)
return;
@@ -178,14 +179,7 @@
return;
/* try to load local files directly. */
- lwc_string *scheme = nsurl_get_component(hlcache_handle_get_url(content), NSURL_SCHEME);
- if (scheme == NULL)
- return;
-
- bool match;
- if (lwc_string_isequal(scheme, corestring_lwc_file, &match) == lwc_error_ok && match == true)
- path = url_to_path(nsurl_access(hlcache_handle_get_url(content)));
- lwc_string_unref(scheme);
+ netsurf_nsurl_to_path(hlcache_handle_get_url(content), &path);
if (path == NULL) {
/* We cannot release the requested filename until after it
diff --git a/cocoa/fetch.h b/cocoa/fetch.h
index 5d2e9288d..1b0991ef5 100644
--- a/cocoa/fetch.h
+++ b/cocoa/fetch.h
@@ -17,5 +17,3 @@
*/
extern struct gui_fetch_table *cocoa_fetch_table;
-
-char *url_to_path(const char *url);
diff --git a/cocoa/fetch.m b/cocoa/fetch.m
index 8cc2cb966..df424c3e8 100644
--- a/cocoa/fetch.m
+++ b/cocoa/fetch.m
@@ -95,18 +95,6 @@ static const char *fetch_filetype(const char *unix_path)
return cocoafiletype;
}
-char *url_to_path(const char *url)
-{
- NSURL *nsurl = [NSURL URLWithString: [NSString stringWithUTF8String: url]];
- return strdup([[nsurl path] UTF8String]);
-}
-
-static char *path_to_url(const char *path)
-{
- return strdup( [[[NSURL fileURLWithPath: [NSString stringWithUTF8String: path]]
- absoluteString] UTF8String] );
-}
-
static nsurl *gui_get_resource_url(const char *path)
{
nsurl *url = NULL;
@@ -118,8 +106,6 @@ static nsurl *gui_get_resource_url(const char *path)
static struct gui_fetch_table fetch_table = {
.filetype = fetch_filetype,
- .path_to_url = path_to_url,
- .url_to_path = url_to_path,
.get_resource_url = gui_get_resource_url,
};