How to turn unix executables into .app?
How to turn unix executables(read: cross-platform c source) into .app?
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Thanks.
(Before this I managed to get it to work by copying Audacity, going into the Audacity unix executable and replacing it with my exec and changing its name. I didn't think it was a proper way. EDIT: I only needed to replace instances of "Audacity" in info.plist with my app's name.)
(Before this I managed to get it to work by copying Audacity, going into the Audacity unix executable and replacing it with my exec and changing its name. I didn't think it was a proper way. EDIT: I only needed to replace instances of "Audacity" in info.plist with my app's name.)
I followed Apple's documentation but couldn't get my app to recognise resources in the Resource directory of the bundle; instead the resources are only recognised when placed outside the bundle. Currently it defeats the idea of having a bundle at all. Is there something I need to do? Apple's doc is all xcode xcode xcode :/
What does it mean for your resources not to be "recognized"? If you mean that trying to fopen them with relative paths doesn't work, you'll need to use NSBundle or CFBundle to get the resource path. The working directory on Mac OS X is usually neither the application's Resources directory nor the directory containing the application bundle itself, so you'll have to chdir to an absolute location first.
ThemsAllTook Wrote:What does it mean for your resources not to be "recognized"? If you mean that trying to fopen them with relative paths doesn't work, you'll need to use NSBundle or CFBundle to get the resource path. The working directory on Mac OS X is usually neither the application's Resources directory nor the directory containing the application bundle itself, so you'll have to chdir to an absolute location first.
:S I need Obj-C? That's not going to be easy.... I know how to edit and add to existing Obj-C code from... say a template project in XCode and make a decent Cocoa app... but from scratch I have no idea where to start.... not even what google keywords to put in. (Apple docs don't help non-obj-c people very much....)
Would I do what SDLMain.h in SDL.framework does, and simply include the files in our source to compile together? eg. header
Code:
#import <Cocoa/Cocoa.h>
#import "SDL/SDL.h"
@interface SDLMain : NSObject
@end
You can do it without Objective-C by using CFBundle, which is a C API:
If this is cross-platform code, you can wrap the relevant sections in #ifdef __APPLE__ ... #endif.
Code:
#include <limits.h>
#include <unistd.h>
#include <CoreFoundation/CoreFoundation.h>
...
char resourcePath[PATH_MAX];
CFBundleRef mainBundle;
CFURLRef resourcesDirectoryURL;
mainBundle = CFBundleGetMainBundle();
resourcesDirectoryURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
CFURLGetFileSystemRepresentation(resourcesDirectoryURL, true, (UInt8 *) resourcePath, PATH_MAX);
CFRelease(resourcesDirectoryURL);
chdir(resourcePath);
If this is cross-platform code, you can wrap the relevant sections in #ifdef __APPLE__ ... #endif.
Thanks heaps!!!
Possibly Related Threads...
Thread: | Author | Replies: | Views: | Last Post | |
Converting unix SDL project to xcode | Dominus | 0 | 5,576 |
Jan 3, 2011 04:46 AM Last Post: Dominus |
|
Turn Based Game API Released | skilesare | 0 | 5,322 |
Dec 11, 2008 06:18 PM Last Post: skilesare |
|
Stupid UNIX/svn question | stevejohnson | 5 | 6,332 |
Dec 1, 2008 02:34 AM Last Post: leRiCl |
|
Stupid xcode question: How do I turn off precompiled headers? | SourceIT | 2 | 10,923 |
Aug 30, 2008 12:53 PM Last Post: SourceIT |
|
BSD Unix to Mac OS X | Carlos Camacho | 5 | 4,832 |
Jan 13, 2004 09:08 AM Last Post: Steven |