Implemented system_get_canonical.
parent
57c0707284
commit
9b0708a40c
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include <libproc.h> // NOTE(yuval): Used for proc_pidpath
|
#include <libproc.h> // NOTE(yuval): Used for proc_pidpath
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h> // NOTE(yuval): Used for pid_t
|
||||||
#include <unistd.h> // NOTE(yuval): Used for getpid
|
#include <unistd.h> // NOTE(yuval): Used for getpid
|
||||||
|
|
||||||
#define external extern "C"
|
#define external extern "C"
|
||||||
|
@ -41,6 +41,21 @@
|
||||||
}
|
}
|
||||||
@end
|
@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
|
external i32
|
||||||
mac_get_binary_path(void *buffer, u32 size){
|
mac_get_binary_path(void *buffer, u32 size){
|
||||||
pid_t pid = getpid();
|
pid_t pid = getpid();
|
||||||
|
@ -52,6 +67,10 @@ mac_get_binary_path(void *buffer, u32 size){
|
||||||
int
|
int
|
||||||
main(int arg_count, char **args){
|
main(int arg_count, char **args){
|
||||||
@autoreleasepool{
|
@autoreleasepool{
|
||||||
|
NSFileManager *fileManager = [[NSFileManager alloc] init];
|
||||||
|
NSString *displayNameAtPath = [fileManager displayNameAtPath:@"build"];
|
||||||
|
NSLog(@"Display Name: %@", displayNameAtPath);
|
||||||
|
|
||||||
// NOTE(yuval): Create NSApplication & Delegate
|
// NOTE(yuval): Create NSApplication & Delegate
|
||||||
NSApplication* app = [NSApplication sharedApplication];
|
NSApplication* app = [NSApplication sharedApplication];
|
||||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||||
|
|
|
@ -46,10 +46,7 @@ system_get_path_sig(){
|
||||||
|
|
||||||
function
|
function
|
||||||
system_get_canonical_sig(){
|
system_get_canonical_sig(){
|
||||||
String_Const_u8 result = {};
|
String_Const_u8 result = mac_standardize_path(arena, name);
|
||||||
|
|
||||||
NotImplemented;
|
|
||||||
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue