#include <mach/mach_time.h>
#include <sys/utsname.h>
+#include <unistd.h>
+#include <stdio.h>
#include "master.hpp"
}
}
-/* You must free() this yourself. */
+// You must free() this yourself.
const char* vm_executable_path(void) {
return safe_strdup([[[NSBundle mainBundle] executablePath] UTF8String]);
}
if ([path hasSuffix:@".app"] || [path hasSuffix:@".app/"]) {
NSFileManager* mgr = [NSFileManager defaultManager];
+ NSString* root = [path stringByDeletingLastPathComponent];
+ NSString* resources = [path stringByAppendingPathComponent:@"Contents/Resources"];
- NSString* imageInBundle =
- [[path stringByAppendingPathComponent:@"Contents/Resources"]
- stringByAppendingPathComponent:image];
- NSString* imageAlongBundle = [[path stringByDeletingLastPathComponent]
- stringByAppendingPathComponent:image];
+ NSString* imageInBundle = [resources stringByAppendingPathComponent:image];
+ NSString* imageAlongBundle = [root stringByAppendingPathComponent:image];
returnVal = ([mgr fileExistsAtPath:imageInBundle] ? imageInBundle
: imageAlongBundle);
returnVal = [returnVal stringByDeletingLastPathComponent];
returnVal = [returnVal stringByDeletingLastPathComponent];
returnVal = [returnVal stringByAppendingPathComponent:image];
+
} else {
returnVal = [path stringByAppendingPathComponent:image];
}
mach_initialize();
}
-/* Amateurs at Apple: implement this function, properly! */
+// Amateurs at Apple: implement this function, properly!
Protocol* objc_getProtocol(char* name) {
if (strcmp(name, "NSTextInput") == 0)
return @protocol(NSTextInput);