Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wrapping NSTask, setting PATH env var to current user's PATH...



Hi everyone,
I'm wrapping command-line tools with NSTask (while getting a hang of Cocoa, so be gentle).
I'm far more used to working at the command line and with Ruby in particular, but I'm not currently interested in RubyCocoa, more in learning Cocoa itself.
I need some help here with setting the PATH environment variable of the NSTask process to the current user's PATH environment variable.
Would this require some mucking around in the various dot-files in a user's home directory and reading .bash_login, .bashrc, .bash_profile, etc...?
Or is there some stupid simple Cocoa method of getting the user's PATH setting and setting the NSTask's environment dictionary's PATH key's value?



What I've currently got is a simple wrapper for the 'which' tool. I'm trying to use it for sanity checking for other tool wrappers, to check for the existence of tools on launch.
In particular this will make it easy to ensure that the one found in the user's PATH (most likely version of a given tool that the user would expect to be used) is the tool that is used.


I do have both of the Advanced OS X Programming book and have played with the Moriarity task wrapper app from ADC.

Cheers,
John Joyce
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.