@thomas
Quote:
Do *not* use file i/o on environment variables!
Why not? Most of the system prefs programs save their prefs files with file i/o. Check the prefs system files in SYS:Prefs/env-archive and you will see that most of them are IFF files (FORM). The system prefs programs are obvioulsy using iffparse.library to load and save their prefs with file i/o. In addition, if you search your system partition for the words ENV: and ENVARC: and you will find dozens of programs containing those words. Why would a program need to know about ENV: and ENVARC: if it's using the environmental variable functions like GetVar() or SetVar() to set prefs?
It is recommended that we use designated functions to access environmental variable instead of using file i/o, but if the system programs do it then it won't do any harm for us to do the same. The old saying "What's good for the goose is good for the gander" comes to mind.
We've also been misled by the claim that the ENV: device only acceses saved variables when they are requested with GetEnv. If you doubt that try this:
Save an environmental variable with SetEnv SAVE myvar "variable test".
Perform a warm system reboot.
Enter "GetEnv myvar" from a shell while watching your hard-disk LED.
You won't detect any disk activity but you will get the value of "myvar".