Re: determine whether an ancillary program/task can run

2011-09-02 Thread Rainer Brockerhoff
On 02/09/2011, at 00:13, Ken Thomases wrote: > On Sep 1, 2011, at 6:42 PM, Rainer Brockerhoff wrote: > >> On 01/09/2011, at 20:17, cocoa-dev-requ...@lists.apple.com wrote: >>> From: Martin Wierschin >>> Date: 1 de setembro de 2011 19:11:24 BRT >>> To: Dave DeLong >>> Cc: Cocoa Dev List >>> >

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Ken Thomases
On Sep 1, 2011, at 6:42 PM, Rainer Brockerhoff wrote: > On 01/09/2011, at 20:17, cocoa-dev-requ...@lists.apple.com wrote: >> From: Martin Wierschin >> Date: 1 de setembro de 2011 19:11:24 BRT >> To: Dave DeLong >> Cc: Cocoa Dev List >> >> Offhand does anyone know how to inspect the architectur

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Rainer Brockerhoff
On 01/09/2011, at 20:17, cocoa-dev-requ...@lists.apple.com wrote: > From: Martin Wierschin > Date: 1 de setembro de 2011 19:11:24 BRT > To: Dave DeLong > Cc: Cocoa Dev List > > Offhand does anyone know how to inspect the architecture(s) of a plain > executable file? I've been googling for a l

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Scott Ribe
On Sep 1, 2011, at 5:07 PM, Martin Wierschin wrote: > Thank you Scott, that's good to know. And I just noticed it even has a nice > "-verify_arch" option, so I'm not stuck parsing output. I guess this is the > best solution. Oh, that's cool. There's probably a UNIX system call for this without

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Martin Wierschin
>> Offhand does anyone know how to inspect the architecture(s) of a plain >> executable file? I've been googling for a little bit and haven't hit upon >> anything that works yet. > > Use NSTask to launch lipo -info. (It's part of the standard install; does not > require dev tools.) Thank you S

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Martin Wierschin
>> The problem is that this ancillary program is sometimes Intel-only, or >> sometimes PPC-only, while the main application is Universal. The use of this >> ancillary program is not mandatory, so displaying an error message, or using >> a fallback solution is acceptable. The issue is that trying

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Philip Ershler
On Sep 1, 2011, at 4:33 PM, Peter wrote: > > Am 02.09.2011 um 00:19 schrieb Philip Ershler: > >> >> On Sep 1, 2011, at 4:11 PM, Martin Wierschin wrote: >> >>> Hi Dave, >>> >>> Thanks for your reply. I was hoping to avoid handling that inspection >>> myself, but even if I go that route there

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Scott Ribe
On Sep 1, 2011, at 4:11 PM, Martin Wierschin wrote: > Offhand does anyone know how to inspect the architecture(s) of a plain > executable file? I've been googling for a little bit and haven't hit upon > anything that works yet. Use NSTask to launch lipo -info. (It's part of the standard install

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Peter
Am 02.09.2011 um 00:19 schrieb Philip Ershler: > > On Sep 1, 2011, at 4:11 PM, Martin Wierschin wrote: > >> Hi Dave, >> >> Thanks for your reply. I was hoping to avoid handling that inspection >> myself, but even if I go that route there's another problem: the ancillary >> tool isn't a prope

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Jens Alfke
On Sep 1, 2011, at 2:09 PM, Martin Wierschin wrote: > The problem is that this ancillary program is sometimes Intel-only, or > sometimes PPC-only, while the main application is Universal. The use of this > ancillary program is not mandatory, so displaying an error message, or using > a fallbac

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Martin Wierschin
>> Thanks for your reply. I was hoping to avoid handling that inspection >> myself, but even if I go that route there's another problem: the ancillary >> tool isn't a proper bundle, it's just a plain executable, so NSBundle's >> initializers will just return nil. That's a pity because there's ev

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Philip Ershler
On Sep 1, 2011, at 4:11 PM, Martin Wierschin wrote: > Hi Dave, > > Thanks for your reply. I was hoping to avoid handling that inspection myself, > but even if I go that route there's another problem: the ancillary tool isn't > a proper bundle, it's just a plain executable, so NSBundle's initia

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Martin Wierschin
Hi Dave, Thanks for your reply. I was hoping to avoid handling that inspection myself, but even if I go that route there's another problem: the ancillary tool isn't a proper bundle, it's just a plain executable, so NSBundle's initializers will just return nil. That's a pity because there's even

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Dave DeLong
You could probably catch this before attempting to launch the task. Create a new NSBundle object pointing at the executable path, and then ask the bundle for the -executableArchitectures, and see if one of the returned values matches the architecture of the machine you're running. If it matches

determine whether an ancillary program/task can run

2011-09-01 Thread Martin Wierschin
Hello all, My application sometimes need to run an ancillary program (included in the app's resources). I do this via NSTask and normally it works great. The problem is that this ancillary program is sometimes Intel-only, or sometimes PPC-only, while the main application is Universal. The use