As KompoZer seems to be the goto example for the latest in PAF and such I went there when I wanted to see an example of how to handle an app that writes to the APPDATA environment variable path. But I am confused.
line 115 Var APPDATAPATH line 123 ReadEnvStr $APPDATAPATH "APPDATA"
so the APPDATA environment variable is being read into the $APPDATAPATH nsis variable. however $APPDATAPATH doesn't get referenced ever again.
line 461 Delete "$APPDATA\KompoZer\pluginreg.dat" line 462 RMDir "$APPDATA\KompoZer\" ;=== Will only delete if empty (no /r switch)
maybe APPDATAPATH is supoosed to be here in place of $APPPATH?
(the code described here also shows up this way in ThunderbirdPortable and FirefoxPortable)
At any rate the method of handling APPDATA seems to allow the blind overwriting of anything in the APPDATA path and just deleting it when done. Is it assumed that everything in that directory is regenerated every application start and as such is ok to overwrite as opposed to backup/replace?
Thank you for helping me understand.
question. And I cant help you answering it. But I know that the $APPDATA variable is used by windows too and doesn't have to be specified. And in this case its special because it is only needed if you set Kompozer to run locally. And it only deletes the pluginreg file and not the whole APPDATA/KompoZer folder in case a local version is installed you wouldn't want to mess with. Deleting the pluginreg is safe as it gets regenerated if it isn't there at startup.
The more common procedure is to redirect the Appdata variable to the settings folder.
"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate
I too think that's a very good question. It does look like that $APPDATAPATH variable is set, but not used again.
$APPDATA is supposed to be a "constant" that does about the same thing, so maybe you're on to something. (As a constant it wouldn't need to be declared or set.)
Some programs use the actual environment variable, while others look for the value of HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\AppData in the registry. Some programs keep their configuration data and preferences in the AppData directory tree, some in the Registry, and some use both. It can be a chore to figure it all out, especially since each program tends to be different.