FROM : Tom Harrington
DATE : Sat Mar 22 23:36:40 2008
On Sat, Mar 22, 2008 at 4:26 PM, Carsten <<email_removed>> wrote:
> However, image processing apps can benefit from batch modes, and
> although some things can be nicely handled by an in-app batch manager,
> the ideal would be to also allow the application to be run from the
> commandline, as a traditional unix utility.
>
> Given the .app bundle format of Cocoa apps, I don't quite see how I
> would do this. In main(), I have added an if contingent on the
> existence of commandline parameters (which can be refined in case Mac
> OS X uses these to launch drag-n-drop scenarios, something which I
> don't know yet), which doesn't load the GUI in case the app has been
> launched in commandline batch mode, but the executable is deep inside
> the .app bundle...
>
> What is the traditional Mac OS X/Cocoa way of handling such a
> scenario, or is it simply not do it like this, and to force the user
> to use an in-app batch manager?
You could just use the executable in the .app bundle, though it would
lead to some very long command lines. For example you can run
TextEdit with "/Applications/TextEdit.app/Contents/MacOS/TextEdit".
One approach that some apps take is to have a separate command-line
tool which could be installed in /usr/local/bin or some other more
normal-seeming place. With this approach you'd probably have a
regular drag-install app bundle with a menu item to optionally install
the command-line tool. Depending on your architecture the
command-line tool could be as simple as a symbolic link to the main
bundle's binary.
Depending on your requirements, you might consider whether the
batch-mode processing would be better implemented as an Automator
action.
--
Tom Harrington
<email_removed>
AIM: atomicbird1
DATE : Sat Mar 22 23:36:40 2008
On Sat, Mar 22, 2008 at 4:26 PM, Carsten <<email_removed>> wrote:
> However, image processing apps can benefit from batch modes, and
> although some things can be nicely handled by an in-app batch manager,
> the ideal would be to also allow the application to be run from the
> commandline, as a traditional unix utility.
>
> Given the .app bundle format of Cocoa apps, I don't quite see how I
> would do this. In main(), I have added an if contingent on the
> existence of commandline parameters (which can be refined in case Mac
> OS X uses these to launch drag-n-drop scenarios, something which I
> don't know yet), which doesn't load the GUI in case the app has been
> launched in commandline batch mode, but the executable is deep inside
> the .app bundle...
>
> What is the traditional Mac OS X/Cocoa way of handling such a
> scenario, or is it simply not do it like this, and to force the user
> to use an in-app batch manager?
You could just use the executable in the .app bundle, though it would
lead to some very long command lines. For example you can run
TextEdit with "/Applications/TextEdit.app/Contents/MacOS/TextEdit".
One approach that some apps take is to have a separate command-line
tool which could be installed in /usr/local/bin or some other more
normal-seeming place. With this approach you'd probably have a
regular drag-install app bundle with a menu item to optionally install
the command-line tool. Depending on your architecture the
command-line tool could be as simple as a symbolic link to the main
bundle's binary.
Depending on your requirements, you might consider whether the
batch-mode processing would be better implemented as an Automator
action.
--
Tom Harrington
<email_removed>
AIM: atomicbird1
| Related mails | Author | Date |
|---|---|---|
| Carsten | Mar 22, 23:26 | |
| Tom Harrington | Mar 22, 23:36 | |
| Carsten | Mar 23, 00:01 | |
| Marcus | Mar 23, 06:46 | |
| Carsten | Mar 23, 09:10 | |
| Marcus | Mar 23, 09:31 | |
| Carsten | Mar 23, 09:43 | |
| Brian Stern | Mar 23, 18:35 | |
| Carsten | Mar 23, 22:08 | |
| Scott Ribe | Mar 23, 22:16 | |
| Sherm Pendley | Mar 23, 22:35 | |
| Carsten | Mar 23, 22:43 |






Cocoa mail archive

