You can't use NSBundle for something like this as your tool is not
inside one. Remember: bundles are structured directories owned and
controled by your code, and a preexisting system-wide one is not. You
can, however, use NSTask for this purpose. Once set up you have the
complement of  the setLaunchPath: method, called launchPath to get
said info. But if you set it up the way you showed in the example,
chances are you already have that info. the method is much more
usefull when you created the launch path from separate strings and
lost them since, in my opinion.

As for the error you're getting I can't help as I don't know what's on
line 133 :P

On Sat, Nov 20, 2010 at 5:11 PM, Csanyi Pal <[email protected]> wrote:
> Hi,
>
> is it possible to find (using NSBundle) or determine (using NSTask) an
> installed tool (say this tool is installed in /usr/local/bin/ directory)
> and when get it's path, then run it from my app as a subtask?
>
> I'm trying this but without success:
> [code]
> NSTask *DPSetBit0;
> DPSetBit0 = [[NSTask alloc] init];
> [DPSetBit0 setLaunchPath: @"/usr/local/bin"];
> [DPSetBit0 launch];
> [/code]
>
> but when compiling get errors:
>  Compiling file MainController.m ...
> MainController.m: In function ‘-[MainController DPbitSetReset:]’:
> MainController.m:133: error: a label can only be part of a statement and
>  a declaration is not a statement
> make[3]: *** [obj/LPT_Interface.obj/MainController.m.o] Error 1
> make[2]: *** [internal-app-run-compile-submake] Error 2
> make[1]: *** [LPT_Interface.all.app.variables] Error 2
> make: *** [internal-all] Error 2
>
> --
> Regards, Paul Chany
> <http://sourceforge.net/projects/lptinterface/>
> <http://savannah.nongnu.org/projects/lpt-interface/>
> <http://csanyi-pal.info>
>
>
> _______________________________________________
> Discuss-gnustep mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/discuss-gnustep
>



-- 
Besos, abrazos, confeti y aplausos.
Jamie Ramone
"El Vikingo"

_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to