Rein Masamuri
20th September 2009 19:14 UTC
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.
820815
20th September 2009 20:24 UTC
$EXEDIR
Rein Masamuri
20th September 2009 22:02 UTC
Well that's odd. It's still not deleting.
Is there a bug in NSIS that sometimes doesn't delete?
pengyou
21st September 2009 00:30 UTC
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"
Rein Masamuri
21st September 2009 04:01 UTC
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
Rein Masamuri
22nd September 2009 22:00 UTC
I'm still unable to do the deletion/rename :(
MSG
23rd September 2009 08:42 UTC
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.