From ff0aa37393afad23c5f114634a1df6f4b64fdb71 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Sun, 27 Feb 2011 13:21:42 +0000 Subject: [PATCH] Implementing path utility functions. svn path=/trunk/netsurf/; revision=11841 --- cocoa/utils.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cocoa/utils.m b/cocoa/utils.m index cc8b29f81..c9cef7a23 100644 --- a/cocoa/utils.m +++ b/cocoa/utils.m @@ -44,14 +44,16 @@ void PDF_Password(char **owner_pass, char **user_pass, char *path) char *filename_from_path(char *path) { - UNIMPL(); - return NULL; + return strdup( [[[NSString stringWithUTF8String: path] lastPathComponent] UTF8String] ); } bool path_add_part(char *path, int length, const char *newpart) { - UNIMPL(); - return false; + NSString *newPath = [[NSString stringWithUTF8String: path] stringByAppendingPathComponent: [NSString stringWithUTF8String: newpart]]; + + strncpy( path, [newPath UTF8String], length ); + + return true; } void tree_icon_name_from_content_type(char *buffer, content_type type)