diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-01-16 00:01:25 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-01-16 00:01:25 +0000 |
commit | 38cb39339a8f1f9a0afb69340a404fd767db5a79 (patch) | |
tree | 0b5ed63f639e8d8e66011a425ee595545b74300d /cocoa | |
parent | bd065d4a434755e67642a071e255cba596de8d1e (diff) | |
download | netsurf-38cb39339a8f1f9a0afb69340a404fd767db5a79.tar.gz netsurf-38cb39339a8f1f9a0afb69340a404fd767db5a79.tar.bz2 |
move filename_from_path and path_add_part into gui operation tables
Diffstat (limited to 'cocoa')
-rw-r--r-- | cocoa/gui.m | 16 | ||||
-rw-r--r-- | cocoa/utils.m | 13 |
2 files changed, 16 insertions, 13 deletions
diff --git a/cocoa/gui.m b/cocoa/gui.m index c2cadfe5a..f9cb2e4c7 100644 --- a/cocoa/gui.m +++ b/cocoa/gui.m @@ -281,6 +281,20 @@ void gui_401login_open(nsurl *url, const char *realm, cb( false, cbpw ); } +static char *filename_from_path(char *path) +{ + return strdup( [[[NSString stringWithUTF8String: path] lastPathComponent] UTF8String] ); +} + +static bool path_add_part(char *path, int length, const char *newpart) +{ + NSString *newPath = [[NSString stringWithUTF8String: path] stringByAppendingPathComponent: [NSString stringWithUTF8String: newpart]]; + + strncpy( path, [newPath UTF8String], length ); + + return true; +} + static struct gui_window_table window_table = { .create = gui_window_create, @@ -321,6 +335,8 @@ static struct gui_browser_table browser_table = { .launch_url = gui_launch_url, .create_form_select_menu = gui_create_form_select_menu, .cert_verify = gui_cert_verify, + .filename_from_path = filename_from_path, + .path_add_part = path_add_part, }; struct gui_browser_table *cocoa_browser_table = &browser_table; diff --git a/cocoa/utils.m b/cocoa/utils.m index cd9313d34..61226ad2a 100644 --- a/cocoa/utils.m +++ b/cocoa/utils.m @@ -41,16 +41,3 @@ void PDF_Password(char **owner_pass, char **user_pass, char *path) UNIMPL(); } -char *filename_from_path(char *path) -{ - return strdup( [[[NSString stringWithUTF8String: path] lastPathComponent] UTF8String] ); -} - -bool path_add_part(char *path, int length, const char *newpart) -{ - NSString *newPath = [[NSString stringWithUTF8String: path] stringByAppendingPathComponent: [NSString stringWithUTF8String: newpart]]; - - strncpy( path, [newPath UTF8String], length ); - - return true; -} |