Archive: Finding path of "Application Data" folder in user's machine


Finding path of "Application Data" folder in user's machine
Hi!

While uninstalling I need to delete some files from user's machine. These files are there in the following path
C:\Documents and Settings\develop\Application Data\MyFolder\abc.txt

Upto "Application Data" we have system folders. MyFolder is user created folder. I need to delete file abc.txt from this folder.

Now problem is that the path to Application Data folder may be different in different machines. Then how can I delete this file.

Any any help will be greatly appreciated.

Regards
Saurabh


$APPDATA
The application data directory. Detection of the current user path requires Internet Explorer 4 and above. Detection of the all users path requires Internet Explorer 5 and above. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.


--Now problem is that the path to Application Data folder may be different in different machines

......
......

Section install
SetOutPath "$APPDATA\MyFolder"
File "abc1.txt"
File "abc2.txt"
File "abc3.txt"
FileOpen $0 $INSTDIR\Inst.log w
FileWrite $0 "$APPDATA\MyFolder\abc1.txt$\r$\n"
FileWrite $0 "$APPDATA\MyFolder\abc2.txt$\r$\n"
FileWrite $0 "$APPDATA\MyFolder\abc3.txt$\r$\n"
FileClose $0
SectionEnd

......
......

Section Uninstall
FileOpen $0 $INSTDIR\Inst.log r
read:
FileRead $0 $1
IfErrors close
Delete "$1"
Goto read
close:
FileClose $0
SectionEnd