Thalia
Thalia

Reputation: 14635

NSIS difficulty moving folders

I have an installer that looks for old version, and as part of the uninstall process, backs it up in a folder.

For backup, I have tried Rename (it sometimes fails), CreateDirectory then CopyFiles then delete them (time consuming, lots of files and directories), and have preferred to use Move Folder, where every function is replaced with its un-version (like .MoveFolder_Locate_moveFile -> un.MoveFolder_Locate_moveFile).

StrCpy $switch_overwrite 1
!insertmacro un.MoveFolder "$INSTDIR" "$BACKUP_FOLDER" "*.*"

It was working fine...

Yet I was launching the uninstaller with:

ExecWait '$R0'

As soon as I chnaged it to

ExecWait '$R0 _?=$INSTDIR'

The MoveFile gives an error.

Upvotes: 0

Views: 1189

Answers (1)

Anders
Anders

Reputation: 101764

Running the uninstaller without _?= causes the uninstaller to copy itself to $temp and then run a new instance from there (without waiting). You should try a hybrid of this; copy the uninstaller yourself to $temp and run it with _?=$instdir, this should allow you to wait for the process without locking $instdir...

Upvotes: 1

Related Questions