Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Deleting backup files at end.


6 replies to this topic

antyagi

antyagi
  • Full Members
  • 121 posts

Posted 07 June 2007 - 11:51

During uninstall, I am deleting some txt file created by my application. The CA that delete the file is a deferred CA.
My problem is, after this CA delete files if user click cancel whole uninstallation is rolled-back but I have no way to recreate these deleted files.
To solve this, instead of deleting the files I moved them to temp and if user click cancel moved them back to their original folder.
But now, the problem is, if user does not click cancel the files remain their in temp.

How can I make sure that files get deleted from temp after uninstllation is complete.
Or is there another way to do this?
  ankur tyagi

akerl

akerl
  • Full Members
  • 104 posts

Posted 07 June 2007 - 17:32

You should use a commit custom action (msidbCustomActionTypeCommit) to delete the files. The commit custom action will be executed after the script actions are finished. Meaning that the user can't cancel the installation after this action is executed.

Andreas Kerl

Inside Windows Installer 4.5
ISBN 3-86645-431-7


antyagi

antyagi
  • Full Members
  • 121 posts

Posted 08 June 2007 - 05:42

This is what I am doing now. A commit action after InstallFinalize, in execute sequence.
But I doubt it may fail on Vista, for reason I have written in post http://forum.install...t=0

How MSI removes the backed-up file on completion? Can't I add my files to that list?
  ankur tyagi

akerl

akerl
  • Full Members
  • 104 posts

Posted 08 June 2007 - 08:15

I think here's a mistake. When you create a custom action and integrate it after InstallFinalize, it isn't a commit custom action, it's a immediate CA and this type of CA fail on Vista, because it works with default user privileges. What type ist your CA?

Andreas Kerl

Inside Windows Installer 4.5
ISBN 3-86645-431-7


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 08 June 2007 - 09:45

Did you try using the RemoveFile table instead, thus avoiding the custom actions all together?

antyagi

antyagi
  • Full Members
  • 121 posts

Posted 27 June 2007 - 14:48

Andreas is right Immediate CA after InstallFinalize will fail on Vista when deleting files from folder say Program Files\MyFile.

Stefan, RemoveFile table is definetely the right choice. But in my case I have to ask user if he wants to delete those files, if he choose yes only then I will delete file. However, Removefile table will always delete files irrespective of what user choose. Or is it possible to put condition in RemoveFile table?

I think I will have to write,
1. a deferred CA that will move files to temp.
2. a rollback CA that will move files back to original folder (if user cancel setup).
3. a Immediate CA (afterInstallFinalize) that will delete files from temp folder.

thanks!
  ankur tyagi

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 27 June 2007 - 15:14

This is really a problem. Why and how does your application create those files under ProgramFilesFolder on Vista? You shouldn't do that, and usually Vista would redirect those to a compatibility file store.