diff --git a/platform_mac/mac_4ed.mm b/platform_mac/mac_4ed.mm index cdd47d24..d3c4f601 100644 --- a/platform_mac/mac_4ed.mm +++ b/platform_mac/mac_4ed.mm @@ -12,7 +12,7 @@ #include // NOTE(yuval): Used for proc_pidpath -#include +#include // NOTE(yuval): Used for pid_t #include // NOTE(yuval): Used for getpid #define external extern "C" @@ -41,6 +41,21 @@ } @end +external String_Const_u8 +mac_standardize_path(Arena* arena, String_Const_u8 path){ + NSString *path_ns_str = + [[NSString alloc] initWithBytes:path.data length:path.size encoding:NSUTF8StringEncoding]; + + NSString *standardized_path_ns_str = [path_ns_str stringByStandardizingPath]; + String_Const_u8 standardized_path = SCu8([standardized_path_ns_str UTF8String],[standardized_path_ns_str lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); + + String_Const_u8 result = push_string_copy(arena, standardized_path); + + [path release]; + + return result; +} + external i32 mac_get_binary_path(void *buffer, u32 size){ pid_t pid = getpid(); @@ -52,6 +67,10 @@ mac_get_binary_path(void *buffer, u32 size){ int main(int arg_count, char **args){ @autoreleasepool{ + NSFileManager *fileManager = [[NSFileManager alloc] init]; + NSString *displayNameAtPath = [fileManager displayNameAtPath:@"build"]; + NSLog(@"Display Name: %@", displayNameAtPath); + // NOTE(yuval): Create NSApplication & Delegate NSApplication* app = [NSApplication sharedApplication]; [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; diff --git a/platform_mac/mac_4ed_functions.cpp b/platform_mac/mac_4ed_functions.cpp index e157019b..bb385e2e 100644 --- a/platform_mac/mac_4ed_functions.cpp +++ b/platform_mac/mac_4ed_functions.cpp @@ -46,10 +46,7 @@ system_get_path_sig(){ function system_get_canonical_sig(){ - String_Const_u8 result = {}; - - NotImplemented; - + String_Const_u8 result = mac_standardize_path(arena, name); return(result); }