Archive: Directory the installer is in?


Directory the installer is in?
Is there a way to reference the directory that the installer is in?
I have my installer set up to download Y.txt, compare it with file X.txt (already in the directory the installer is in) If they're different, it will delete file X.txt and rename Y.txt to X.txt
For some reason using these commands won't work:


Section
Delete "X.txt"
Rename "Y.txt" "X.txt"
Quit
SectionEnd

I'm guessing that it requires the absolute directory and I don't know what that directory is because they can put it in any directory.

$EXEDIR


Well that's odd. It's still not deleting.
Is there a bug in NSIS that sometimes doesn't delete?


According to the manual you should specify the full path when using the 'Delete' command.

If the file is in the same folder as the installer then you could use

Delete "$EXEDIR\X.txt"

Originally posted by pengyou
According to the manual you should specify the full path when using the 'Delete' command.

If the file is in the same folder as the installer then you could use
Delete "$EXEDIR\X.txt"
That's what I had:


Section "complete"
Delete "$EXEDIR\y.txt"
Rename "$EXEDIR\x.txt" "$EXEDIR\y.txt"
Quit
SectionEnd

I'm still unable to do the deletion/rename :(


Check whether or not you have sufficient access privileges to delete the file, or if the file is still in use by some application.

Or, more basic: Add a MessageBox line to see what "$EXEDIR\y.txt" resolves to, and to check whether or not those code lines are even reached at all.