I’m trying to write a Cocoa app that makes it easier for Android developers on Macs to create Android apps.
When a user presses a button on the app, I want it to add a certain directory to the environmental $PATH variable on the Mac.
Is there another way to do this via Cocoa instead of opening up the .bash_profile file and adding the path manually?
Thanks for any help in advance.
You could use the
getenv()andsetenv()standard C library calls to change the $PATH for the application itself. This change will only be seen by your application and its child processes.In other words, the $PATH change will not be global. If you want to do that, you will have to change the startup files.