qtinstallationqt-installer

How to delete/clear AppData/Roaming/MyFolder files during uninstall using qt installer framework?


I create a application using qt installer framework. Now uninstalling my app does not remove AppData/Roaming/My app folder. So i tried my custom code for uninstall to clear my AppData. But this makes my installer unresponsive.

Controller.prototype.FinishedPageCallback = function() {

if (installer.isUninstaller() && installer.status == QInstaller.Success)  
     {    
            var appDataPath = QDesktopServices.storageLocation(QDesktopServices.AppDataLocation) + "\\My app";



         if(installer.fileExists(appDataPath) === true)    
         {
                installer.executeDetached("cmd",["/c", "rd", "/q", "/s", appDataPath]);
         }

            gui.clickButton(buttons.FinishButton);
    }  
}

I also tried using

if(installer.runUninstall === true)    

     { 
         installer.performOperation("Execute" , "cmd" "C:/Users/%USERNAME%/AppData/Roaming/My App", "rd", "/s", "/q");  
     }

Does not work either. Am I missing something?


Solution

  • After testing with the installer operations found that Rmdir/ Execute does not work as expected . But delete operation worked for me.

    installer.performOperation("Delete","@HomeDir@/AppData/Roaming/My App/myfile.txt");