I've spent days attacking this and at this point am wondering if what I am trying to do is even possible.
I have a bundled app. In the Contents/MacOS path of the bundle is a console application that when run, goes off and does its own thing. If the app is opened because the user double clicked a file associated with it, or dropped the file on the icon of the app, it must be able to capture the full path of that file.
All of the solutions that I've found have been for a UI based app. Is there any possible way to capture this in a console program like the one I have below? This problem is absolutely killing me. I've wasted so much time on it that at this point, I'm considering scrapping the Mac version of my application entirely.
It seems like this must be an incredibly basic thing to do, but so far it's proven infuriating at every turn. Infinite gratitude to anyone who can help me here.
I have modified the Info.plist file to include:
I have included the following code in the class:
My <DO STUFF> is never hit when I drag/drop files of my type over the application. Any guidance?
Edit: I'm primarily a Java developer, and am really just trying to get this wrapper to present my program. Sorry for the low level of familiarity I have with objective C. It's something I'm trying to pick up here on the fly.
I have a bundled app. In the Contents/MacOS path of the bundle is a console application that when run, goes off and does its own thing. If the app is opened because the user double clicked a file associated with it, or dropped the file on the icon of the app, it must be able to capture the full path of that file.
All of the solutions that I've found have been for a UI based app. Is there any possible way to capture this in a console program like the one I have below? This problem is absolutely killing me. I've wasted so much time on it that at this point, I'm considering scrapping the Mac version of my application entirely.
It seems like this must be an incredibly basic thing to do, but so far it's proven infuriating at every turn. Infinite gratitude to anyone who can help me here.
I have modified the Info.plist file to include:
Code:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>pgt</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>macSet.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>text/xml</string>
</array>
<key>CFBundleTypeName</key>
<string>XML File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSIsAppleDefaultForType</key>
<true/>
</dict>
</array>
I have included the following code in the class:
Code:
@implementation JavaAppLauncherCustom
- (BOOL)application:(NSApplication *)WrapperApp openFile:(NSString *)filename
{
<DO STUFF>
return [self processFile:filename];
}
@end
My <DO STUFF> is never hit when I drag/drop files of my type over the application. Any guidance?
Edit: I'm primarily a Java developer, and am really just trying to get this wrapper to present my program. Sorry for the low level of familiarity I have with objective C. It's something I'm trying to pick up here on the fly.
Last edited: