Re: permanent setenv? [message #50900] |
Wed, 25 October 2006 03:25 |
Jo Klein
Messages: 54 Registered: January 2006
|
Member |
|
|
> Forget the environment, not portable anyway. Write your info into a
> simple text file, and read that. On Unix a .myapprc file in the users
> home will do, for Windows you have to do something else. Leave the
> environment to the user, do not mess with it.
You can use that approach on Windows, too. You have to test if you're
running on Windows, though. To get the user's home directory, you can
getenv('USERPROFILE') and use that instead of ~.
Cheers,
Jo
|
|
|
Re: permanent setenv? [message #50901 is a reply to message #50900] |
Wed, 25 October 2006 02:17  |
Maarten[1]
Messages: 176 Registered: November 2005
|
Senior Member |
|
|
Wox wrote:
> Is there a way of adding an environment variable, like SETENV does,
> but then permanent?
>
> For windows one could make a .reg file and spawn regedit, adding
> something to "HKEY_CURRENT_USER\Environment".
>
> For Linux one could add an "export" line to .bashrc or .profile or ...
>
> One could try doing this for all the available OS's. Isn't there a
> more generic/uniform way of doing this? (Maybe
> "HKEY_CURRENT_USER\Environment" is ok for WinXP, but is it for 2000?
> Maybe you are using another shell on linux, so the 'export' line
> should be added to .kshrc,...)
Forget the environment, not portable anyway. Write your info into a
simple text file, and read that. On Unix a .myapprc file in the users
home will do, for Windows you have to do something else. Leave the
environment to the user, do not mess with it.
Maarten
|
|
|