 |
|
 |
|
Next: Carbon/TWAIN issues...
|
| Author |
Message |
External

Since: Mar 01, 2004 Posts: 4
|
(Msg. 1) Posted: Mon Mar 01, 2004 9:29 am
Post subject: GUI wrapper for command line application Archived from groups: comp>sys>mac>programmer>help (more info?)
|
|
|
Hi,
I'm trying to write a GUI wrapper for a command line application and am
following Apple's Moriarity example.
Launching the command line app works fine as long as I put it anywhere *but*
the GUI application bundle.
If I put it in the bundle (as I would like the program to be self-contained)
I get a "not found" error.
I made sure that the path is right, but it won't work.
What am I doing wrong?
Thanks for any suggestions,
Carlo |
|
| Back to top |
|
 |  |
External

Since: Mar 01, 2004 Posts: 20
|
(Msg. 2) Posted: Mon Mar 01, 2004 9:29 am
Post subject: Re: GUI wrapper for command line application [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Mon, 1 Mar 2004, Carlo Noben wrote:
> I'm trying to write a GUI wrapper for a command line application and am
> following Apple's Moriarity example.
>
> Launching the command line app works fine as long as I put it anywhere *but*
> the GUI application bundle.
>
> If I put it in the bundle (as I would like the program to be self-contained)
> I get a "not found" error.
Details. What is giving you a 'not found' error? Where are you putting it
in the bundle? How are you starting it? |
|
| Back to top |
|
 |  |
External

Since: Mar 01, 2004 Posts: 20
|
(Msg. 3) Posted: Mon Mar 01, 2004 9:29 am
Post subject: Re: GUI wrapper for command line application [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Mon, 1 Mar 2004, Carlo Noben wrote:
> searchTask=[[TaskWrapper alloc] initWithController:self arguments:[NSArray
> arrayWithObjects:
> @"/Volumes/Titanium/Applications/guitool/build/guitool/Contents/tool",
> [findTextField stringValue], nil]];
Unless you're being really nonstandard, you're missing the ".app"
extension from your application's bundle name. What you see in the Finder
doesn't always match what the filesystem actually contains.
The right way to do this is to put the tool in your bundle's Resources
folder, and then use [[NSBundle mainBundle] pathForResource:ofType:] to
get its path. That way it will work even if you move the app, and you
don't run the risk of making typos or forgetting extensions.
> Sorry for not being more specific right away.
No problem, just keep in mind that if we have no idea what's going on, we
can't help very much.  |
|
| Back to top |
|
 |  |
External

Since: Mar 01, 2004 Posts: 4
|
(Msg. 4) Posted: Mon Mar 01, 2004 11:15 am
Post subject: Re: GUI wrapper for command line application [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
in article 20040301104725.G8539.DeleteThis@agamemnon.twistedsys.net, Michael Ash at
mikeash.DeleteThis@mikeash.com wrote on 3/1/04 4:49 PM:
> On Mon, 1 Mar 2004, Carlo Noben wrote:
>
>> I'm trying to write a GUI wrapper for a command line application and am
>> following Apple's Moriarity example.
>>
>> Launching the command line app works fine as long as I put it anywhere *but*
>> the GUI application bundle.
>>
>> If I put it in the bundle (as I would like the program to be self-contained)
>> I get a "not found" error.
>
> Details. What is giving you a 'not found' error? Where are you putting it
> in the bundle? How are you starting it?
This is how Apple's code does it:
searchTask=[[TaskWrapper alloc] initWithController:self arguments:[NSArray
arrayWithObjects:@"/usr/bin/locate",[findTextField stringValue],nil]];
So I thought I'd put the command line app called 'tool' into the Contents
folder of the GUI wrapper bundle (called 'guitool') and invoke it with the
following command:
searchTask=[[TaskWrapper alloc] initWithController:self arguments:[NSArray
arrayWithObjects:
@"/Volumes/Titanium/Applications/guitool/build/guitool/Contents/tool",
[findTextField stringValue], nil]];
But as I said in my initial message this doesn't work and gives me the
following error in Xcode:
2004-03-01 17:12:55.157 tool[454] launch path not accessible
when clicking the 'Start' button in the GUI wrapper.
Sorry for not being more specific right away.
Carlo |
|
| Back to top |
|
 |  |
External

Since: Mar 01, 2004 Posts: 4
|
(Msg. 5) Posted: Mon Mar 01, 2004 12:19 pm
Post subject: Re: GUI wrapper for command line application [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
in article 20040301112344.U8539 DeleteThis @agamemnon.twistedsys.net, Michael Ash at
mikeash DeleteThis @mikeash.com wrote on 3/1/04 5:30 PM:
> On Mon, 1 Mar 2004, Carlo Noben wrote:
>
>> searchTask=[[TaskWrapper alloc] initWithController:self arguments:[NSArray
>> arrayWithObjects:
>> @"/Volumes/Titanium/Applications/guitool/build/guitool/Contents/tool",
>> [findTextField stringValue], nil]];
>
> Unless you're being really nonstandard, you're missing the ".app"
> extension from your application's bundle name. What you see in the Finder
> doesn't always match what the filesystem actually contains.
>
Oops, I feel really stupid now. Indeed, I forgot to add the .app extension.
It works perfectly now.
> The right way to do this is to put the tool in your bundle's Resources
> folder, and then use [[NSBundle mainBundle] pathForResource:ofType:] to
> get its path. That way it will work even if you move the app, and you
> don't run the risk of making typos or forgetting extensions.
Incidentally, I tried this first, but couldn't get it to work either. So I
wanted to try it a hard coded path first. I just found out that I omitted
the ofType:@"" parameter (as command line tools normally don't have a
Creator nor Type, so I just made it empty). Now that version works
perfectly, too.
Thank you very much for your help!
Carlo |
|
| Back to top |
|
 |  |
External

Since: Jun 22, 2005 Posts: 268
|
(Msg. 6) Posted: Mon Mar 01, 2004 5:51 pm
Post subject: Re: GUI wrapper for command line application [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
In article <BC692042.49E9%carlo.noben@education.lu>,
Carlo Noben <carlo.noben.DeleteThis@education.lu> wrote:
> So I thought I'd put the command line app called 'tool' into the Contents
> folder of the GUI wrapper bundle (called 'guitool')
Don't put it in /Contents. Put it in /Contents/Resources/ (or was that
/Contents/MacOS/ ?).
> searchTask=[[TaskWrapper alloc] initWithController:self arguments:[NSArray
> arrayWithObjects:
> @"/Volumes/Titanium/Applications/guitool/build/guitool/Contents/tool",
> [findTextField stringValue], nil]];
Your application isn't named guitool. It is named guitool.app. That's
why it can't be found. And don't hard-code the path, instead use:
[[NSBundle mainBundle] pathForAuxiliaryExecutable: @"tool"]
or
[[NSBundle mainBundle] pathForResource: @"tool" ofType: @""]
Cheers,
-- Uli
http://www.zathras.de |
|
| Back to top |
|
 |  |
External

Since: May 10, 2004 Posts: 1194
|
(Msg. 7) Posted: Mon Mar 01, 2004 5:51 pm
Post subject: Re: GUI wrapper for command line application [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
In article <witness-B27B0A.23510301032004 DeleteThis @news.t-online.com>,
Uli Kusterer <witness DeleteThis @t-online.de> wrote:
> In article <BC692042.49E9%carlo.noben@education.lu>,
> Carlo Noben <carlo.noben DeleteThis @education.lu> wrote:
>
> > So I thought I'd put the command line app called 'tool' into the Contents
> > folder of the GUI wrapper bundle (called 'guitool')
>
> Don't put it in /Contents. Put it in /Contents/Resources/ (or was that
> /Contents/MacOS/ ?).
Contents/MacOS if it's architecture-specific, Contents/Resources if it's not
(i.e. a shell script)
meeroh
--
If this message helped you, consider buying an item
from my wish list: <http://web.meeroh.org/wishlist> |
|
| Back to top |
|
 |  |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|