0

I have a "libsndfile" Automake based command like utility I ported to MAC OS Mavericks. I wrote a tiny GUI for it, to select a file in finder, using Xcode and NSOpenPanel class. My GUI povides me with the file name I select.

How do I tie the 2 pieces together? I want to create a DMG file which installs the GUI and command line utility, and calls that command line utility with the file name obtained from the GUI.

Example:

2014-04-02 03:37:23.775 Splitter[542:303] file:///Users/simon/src/libsndfile-1.0.25/RefFiles/take2_ch7n8.wav

is received from GUI. And then call the utility:

sndfile-deinterleave ./take2_ch7n8.wav 

to split the file.

Sorry if this is a basic question. Do not have much experience with Xcode and OS-X Applications.

TheAmateurProgrammer
  • 9,252
  • 8
  • 52
  • 71
  • A `.DMG` is a [disk image](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/hdiutil.1.html), not an installer, although it could contain an installer. – l'L'l Apr 02 '14 at 11:10
  • OK, can you please suggest how to create the installer then? It needs to install command line and GUI both – user22751 Apr 02 '14 at 13:28

1 Answers1

0

The class you are looking for is NSTask

However, be aware that this gets the environment from your application, so don't expect to have the same environment that you see when you are running the command line app from the terminal. This bit me a few years back, and I asked a question about it.

The link to the question also shows an example of using NSTask.

Another thing to be aware of, and is mentioned in the documentation link, is that you need to do a bit more work to get this working in a sandboxed environment.

Community
  • 1
  • 1
Abizern
  • 146,289
  • 39
  • 203
  • 257
  • Now to the other part of my question - how to create an installer for the GUI and the command line together - all as one DMG – user22751 Apr 03 '14 at 11:45