I have componentscript in which I do mkdir and copydir operation during install as per the Qt Documentation http://doc.qt.io/qtinstallerframework/operations.html. Internally, each operation has a DO step that contains instructions for the installer and an UNDO step that contains instructions for the uninstaller. I want the installer not to do the undo step during uninstall . I tried using following functions:
var path =installer.value("HomeDir") + "/AppData/Roaming/myfolder";
component.addOperation("Execute", "mkdir", path, "UNDOEXECUTE", "del", "/S", "/F", path);
component.addOperation("Execute", "cmd", "/C", "mkdir", path, "UNDOEXECUTE", "cmd ", "/C", "rmdir", "/S", /Q", path);
Executing this throws an error "Could not start: 'mkdir my/path'(No program defined) No such file or directory" . Is there any workaround to not to do undo operation of addOperation ?
You don't need to provide UNDO for every operation.
There are some predefined operations, you can use them directly as below
component.addOperation("Mkdir", path);
or
component.addOperation("Rmdir", path);
Or if you don't want UNDO operation at all, use below way to do the same
(For Windows OS)
component.addOperation("Execute", "cmd", "/C", "mkdir " + path);
(For Linux OS)
component.addOperation("Execute", "/bin/sh", "-c", "mkdir " + path);