Question

I have an application I want to bundle (with some additional files) together inside a wrapper application.

Literally the only thing I want to do is have the wrapper application launch a resource file (i.e. as if I'd typed:

/path/to/Resources/Bundled.app/Contents/MacOS/executable

into the terminal.

Make sense? I thought this should be simple, but I caouldn't find a simple way to do this-- my cocoa programming is limited, to say the least.

Thanks in advance!

Was it helpful?

Solution

Your outer program can use NSBundle to locate the inner program within the outer program's bundle.

To run the inner program: If it's an application, use Launch Services or NSWorkspace; if it's a command-line tool, use NSTask.

OTHER TIPS

One way, if the wrapped “application” is just a shell script or something, is Platypus.

If it's an actual application (.app bundle), why does app A do nothing but launch app B? Why have app A at all?

I have a blog post up on this: Turn any shell script into a double-clickable app. The entry mentions "start with an empty app bundle"... which you can get by using the Pashua tool mentioned, if I remember correctly...

Just for the sake of posterity (and if it helps anyone else, here is the full code I used (inside the AppDelegate.m file):

NSString *appName = @"";
NSString *bundledApp = [[NSBundle bundleWithPath:[[NSBundle
                                                           mainBundle] pathForResource:appName ofType:@"app"]]
                          bundlePath];
NSWorkspace *launchApp = [[NSWorkspace alloc] init];
NSLog(@"Launching %s", bundledApp);
[launchApp launchApplication:bundledApp];
[launchApp release];

// Make Launcher terminate (if it serves no other purpose)
[NSApp terminate:nil];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top