Unsolved Qt Installer Framework - Don't uninstall specific files or folders?
-
This is the most I've been able to find on the topic:
https://stackoverflow.com/questions/56882558/qt-installer-framework-how-to-delete-only-certain-files-and-folers-at-uninstal
https://forum.qt.io/topic/105775/ifw-how-did-nt-remove-moved-file-from-simplemovefile-operation-on-uninstallingThe general concept is, you don't delete everything on uninstall. In my case, I particularly don't want to delete something added through:
component.addOperation("Mkdir", "MyDirectoryPath");
The point of this is to have "safe" areas the program installs, like some programs do. For example, some games will have a folder section in Documents with your Saves in there. And the Saves stay intact regardless of whether you uinstall or delete the program itself (so you don't lose Saves if you need to reinstall).
Based on the linked material I've found on this, I'm struggling to figure out how to override
registerPathForUninstallation
such that something added with (for example) Mkdir as mentioned above, is not included.Any ideas?
(Side note: I noticed that if, after installation, you manually put something in a folder created through
addOperation / Mkdir
, it will fail to delete the directory on uninstall, but will say there's an error and ask you to retry or ignore. I gather this has to do with what I've read about it not deleting things if the installer didn't add them. But I'd rather people not be confronted with an error message and think there's a problem, and I'd rather it didn't even try to delete things I don't want it to.)For reference, this is what my installscript.qs looks like:
function Component() { } Component.prototype.createOperations = function() { component.createOperations(); if (installer.value("os") === "win") { component.addOperation("CreateShortcut", "@TargetDir@/MyAppName.exe", "@DesktopDir@/MyAppName.lnk"); component.addOperation("CreateShortcut", "@TargetDir@/MyAppName.exe", "@StartMenuDir@/MyAppName.lnk"); component.addOperation("Mkdir", "@HomeDir@/Documents/MyAppName"); } }
-
Related to this, does anyone know how to do the Registering Custom Operations step as outlined here? https://doc.qt.io/qtinstallerframework/scripting.html
It doesn't say anything I can find as to where the class code goes, so that your custom operation is usable in the installer. I tried putting it in the installscript.qs, but it just gives me syntax errors, so I'm guessing that's not the place for it. It looks like the kind of code you'd put in .h and .cpp files, respectively, but I have no idea where you'd put those files for it to be recognized in the installer.
The idea is that if I could register a custom operation with the "undo" part blank, maybe it won't remove the stuff created through that operation on uninstall. Could be a silly idea, but I can't try it unless I can figure out how to register a custom operation.
-
Could you find a solution to this? I have the same issue as well couldn't figure out a solution
@Trapezoid_Dreams