我使用qt安装程序框架创建一个应用程序。现在卸载我的应用程序不会删除AppData / Roaming /我的应用程序文件夹。所以我尝试使用自定义代码卸载以清除我的AppData。但这使我的安装程序无法响应。
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);
}
}
我也尝试过使用
if(installer.runUninstall === true)
{
installer.performOperation("Execute" , "cmd" "C:/Users/%USERNAME%/AppData/Roaming/My App", "rd", "/s", "/q");
}
也不起作用。我错过了什么吗?
答案 0 :(得分:0)
我猜罪魁祸首是'我'和'应用'之间的空间。在字符串中 中提供引号:
"\"C:/Users/%USERNAME%/AppData/Roaming/My App\""
答案 1 :(得分:0)
使用安装程序进行测试后,发现Rmdir / Execute无法按预期工作。但删除操作对我有用。
installer.performOperation("Delete","@HomeDir@/AppData/Roaming/My App/myfile.txt");