You are here

KompoZer: APPDATA env variable

3 posts / 0 new
Last post
mstinaff
Offline
Last seen: 14 years 1 month ago
Joined: 2006-10-01 10:58
KompoZer: APPDATA env variable

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.

Simeon
Simeon's picture
Offline
Last seen: 9 years 6 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
Thats a good

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

rab040ma
Offline
Last seen: 2 days 16 hours ago
Joined: 2007-08-27 13:35
I too think that's a very

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.

MC

Log in or register to post comments