• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting env vars from Cocoa with /bin/sh?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting env vars from Cocoa with /bin/sh?


  • Subject: Re: Setting env vars from Cocoa with /bin/sh?
  • From: "David Piasecki" <email@hidden>
  • Date: Wed, 14 Apr 2004 09:28:42 -0700

You know, I ended up solving this problem with the setenv() standard C function. I just pass a command to the system function, and it works great.

David


On Apr 14, 2004, at 9:08 AM, M. Uli Kusterer wrote:

At 18:11 Uhr -0700 08.04.2004, David Piasecki wrote:
I figured out how to set my environment variables from the terminal window with /bin/sh, but it doesn't seem to accept the same commands from my Cocoa program.

I'm trying to do VAR=/Path/To/Whatever

Any ideas how to do this from the confines of Cocoa and Objective-C/C++?

Sorry, backlogged, so I hope I'm not stumbling in late here, but ...

Are you perchance using NSTask to run /bin/sh? NSTask lets you pass in an NSDictionary of environment variables and values to assign to them. That sounds like a very useful way of getting things set up without too much pain.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Setting env vars from Cocoa with /bin/sh?
      • From: "M. Uli Kusterer" <email@hidden>
References: 
 >Setting env vars from Cocoa with /bin/sh? (From: "David Piasecki" <email@hidden>)
 >Re: Setting env vars from Cocoa with /bin/sh? (From: "David Piasecki" <email@hidden>)
 >Re: Setting env vars from Cocoa with /bin/sh? (From: "M. Uli Kusterer" <email@hidden>)

  • Prev by Date: Re: Setting env vars from Cocoa with /bin/sh?
  • Next by Date: Inline tableview editing problem (table doesn't end editing)
  • Previous by thread: Re: Setting env vars from Cocoa with /bin/sh?
  • Next by thread: Re: Setting env vars from Cocoa with /bin/sh?
  • Index(es):
    • Date
    • Thread