Amiga.org
Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: Jose on June 19, 2011, 03:50:48 PM
-
On a tid bit of my free time I'm working on a small network diagnostic utility and I'd like to know if there is any standard way/place whatever to save the preferences of the program ? i.e. like the default sana device to use, packet definitions the user might want to wait for, GUI preferences ....
I realize some stuff goes into preferences directory on sys: IRC, but I think that's more like for the system oriented programs...
José
-
BTW if anyone knows where to get the Style Guide (might have some info related to this too) let me know, it's ridiculous that's it doesn't seem to be available anywhere...
-
The only place your program should save its own prefs is in its own dir that it was run from.
-
@Jose:
You haven't looked very hard I suspect.
http://amigan.1emu.net/aw/
-
if there is any standard way/place whatever to save the preferences of the program ? i.e. like the default sana device to use, packet definitions the user might want to wait for, GUI preferences ....
I realize some stuff goes into preferences directory on sys: IRC, but I think that's more like for the system oriented programs...
The standard location is ENVARC: for the saved configuration and ENV: for the currently used configuration. At boot the ENVARC: content is copied to ENV:. sys directory in this location is reserved for OS preferences.
If your application is a simple one with only need for a single file for preferences you're typically supposed to save them in a appname.prefs. If on the other hand you have several files you should use a subdir appname/file1.prefs appname/file2.prefs etc. As ENV: is stored in RAM: you should avoid storing excessive large files.
When editing settings user is presented with 3 options: Save, Use and Cancel. Save saves the settings to both ENVARC: and ENV:, and the application begins to use the selected configuration. Use saves the settings to ENV: only, and the application begins to use the selected configuration. Cancel discards any changes to the configuration and the application continues to use the old settings.
-
The standard location is ENVARC: for the saved configuration and ENV: for the currently used configuration. At boot the ENVARC: content is copied to ENV:. sys directory in this location is reserved for OS preferences.
If your application is a simple one with only need for a single file for preferences you're typically supposed to save them in a appname.prefs. If on the other hand you have several files you should use a subdir appname/file1.prefs appname/file2.prefs etc. As ENV: is stored in RAM: you should avoid storing excessive large files.
When editing settings user is presented with 3 options: Save, Use and Cancel. Save saves the settings to both ENVARC: and ENV:, and the application begins to use the selected configuration. Use saves the settings to ENV: only, and the application begins to use the selected configuration. Cancel discards any changes to the configuration and the application continues to use the old settings.
A very good explanation!
What is the defining characteristic that determines whether an app should save prefs into its own dir (Work:Apps/JoseMegaProggy/JoseMegaProggy.prefs)
vs. saving in ENVARC: and ENV:
?
I have seen some programs save prefs into S: which I really don't like.
-
What is the defining characteristic that determines whether an app should save prefs into its own dir (Work:Apps/JoseMegaProggy/JoseMegaProggy.prefs)
vs. saving in ENVARC: and ENV:
?
Generally true if the settings are system wide, don't have their own directory, or are multi-user. The Amiga User Interface Style Guide recommends searching...
1) Tool types or command line specified options (e.g. SETTINGS=path)
2) Settings found in program directory (TCL's recommendation)
3) Piru's explanation for ENV: and ENVARC:
If none of these can be found then default settings should be used.
The AUIFSG is well written and still useful today. It can be found online and is worth a look...
http://amigan.1emu.net/aw/style.zip
I have seen some programs save prefs into S: which I really don't like.
Not Amiga User Interface Style Guide compliant. I don't like it either.
-
A very good explanation!
What is the defining characteristic that determines whether an app should save prefs into its own dir (Work:Apps/JoseMegaProggy/JoseMegaProggy.prefs)
vs. saving in ENVARC: and ENV:
?
I have seen some programs save prefs into S: which I really don't like.
If your application doesnt implement Save/Use/Cancel and it has got its own directory then saving preferences to PROGDIR: could be considered. Using PROGDIR: allows easy uninstall (just wipe program dir) without cluttering ENV. On the other hand supporting ENV/ENVARC user could easily switch profiles.
-
@Itix
Does MorphOS support multiuser profiles?
--------------------
I generally prefer progs to keep their stuff in their own PROGDIR: because having thousands of files in ENVARC: slows down the booting process. Of course if a prog has a real need to store stuff in ENVARC: then I am not against it.
-
I generally prefer progs to keep their stuff in their own PROGDIR: because having thousands of files in ENVARC: slows down the booting process. Of course if a prog has a real need to store stuff in ENVARC: then I am not against it.
I generally prefer PROGDIR: for settings also but HappyENV is the answer to slow booting and wasted memory for settings.
http://aminet.net/util/sys/envhandler.lha
-
That's pretty much all the info I wanted, a beer to everyone...