]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/os-macosx.mm
help.html: making search box have first tab index
[factor.git] / vm / os-macosx.mm
index 6583ce8720158c9e0e1024df1503ba4c13ee4bc6..71c70f7a489cf505f1a90c4e7c5a317c64a5e83e 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <mach/mach_time.h>
 #include <sys/utsname.h>
+#include <unistd.h>
+#include <stdio.h>
 
 #include "master.hpp"
 
@@ -38,12 +40,11 @@ const char* default_image_path(void) {
 
   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);
@@ -54,6 +55,7 @@ const char* default_image_path(void) {
     returnVal = [returnVal stringByDeletingLastPathComponent];
     returnVal = [returnVal stringByDeletingLastPathComponent];
     returnVal = [returnVal stringByAppendingPathComponent:image];
+
   } else {
     returnVal = [path stringByAppendingPathComponent:image];
   }