1

I'm having an issue with this backup thing. To be more specific, in the [InstallDelete] section i have the following line
Type: filesandordirs; Name: "{app}\res_mods\*.*"; Tasks: cleaninstall;
and than in the [Files] section I'm trying to copy the content of the folder,that i delete in the [InstallDelete] ,into a backup folder with the following line:

Source: "{app}\res_mods\*"; DestDir: "{app}\_res_mods_{#DateTime}"; Flags: external skipifsourcedoesntexist createallsubdirs recursesubdirs

L.E: I'm asking , if there's any way to copy that files before the [Installdelete] section deletes them :).

BeGiN
  • 363
  • 3
  • 14
  • You can use e.g. the `AfterInstall` function at your `[Files]` entry and remove the `[InstallDelete]` section (since it's processed as the very first section in the [`installation order`](http://jrsoftware.org/ishelp/topic_installorder.htm)). In that function you can manually delete everything from that subdirectory. Btw., are you aware that by doing so, you'll need to write a reverse function (which will restore content of that directory) for the uninstaller ? – TLama Dec 29 '13 at 18:35
  • @TLama Well mate , i don't use uninstaller , my installer's uninstall is Del-key :D , can you guide me a little, with the `AfterInstall` thingy? if i have , in `[Files]` section a line like: `Source: "{#CompPath}\core\*"; DestDir: "{app}"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: core` , where do i have to put the `AfterInstall`? – BeGiN Dec 29 '13 at 19:22
  • I was thinking about a code [`like this`](http://pastebin.com/jXb8NHvL), but I don't like using of the `[Files]` section for making backups. I would rather put the whole backup process into a `[Code]` section and run it before the installation starts. – TLama Dec 29 '13 at 20:05
  • @TLama It works how you said :) , the bad thing , i kinda suck at Pascal scripting but i'll try to make the error handling thing :D – BeGiN Dec 29 '13 at 20:28
  • Unfortunately `DelTree` I've used there won't tell you more than if it succeeded or failed. I'm afraid you won't be able to do anything, if any of the files will be in use. It's just a weak solution. It makes me feel more and more that we need some `[Backup]` section in Inno Setup. Or just a `backup` flag for `[InstallDelete]` entries (for [`this case`](http://stackoverflow.com/questions/20665550/delete-files-not-needed-anymore-because-of-upgrade#comment30949871_20665550)). – TLama Dec 29 '13 at 20:38
  • I mean, what would you do, if you wouldn't be able to delete (for some reason, that you are not able to find) any of the files that you just copied somewhere ? Would that be a reason to stop installation e.g. ? – TLama Dec 29 '13 at 20:44

0 Answers0