fix(cpn): simulator application images cache (#7459)

This commit is contained in:
Neil Horne
2026-06-16 10:22:54 +10:00
committed by GitHub
parent a1021a7a1b
commit 1f5ff50e0b
2 changed files with 16 additions and 12 deletions
+3 -1
View File
@@ -236,12 +236,14 @@ int main(int argc, char *argv[])
if (!tempDir.isValid()) {
qDebug() << "Unable to create application temporary directory";
gAppTempPath = "";
gAppTempPath.clear();
} else {
gAppTempPath = tempDir.path();
if (!QDir(gAppTempPath).mkdir("IMAGES"))
qDebug() << "Unable to create images cache directory:" << Helpers::getImagesCacheDir();
else
qDebug() << "Created images cache directory:" << Helpers::getImagesCacheDir();
}
Profile & profile = g.currentProfile();
+13 -11
View File
@@ -368,20 +368,22 @@ int main(int argc, char *argv[])
Firmware::setCurrentVariant(Firmware::getFirmwareForId(simOptions.firmwareId));
//qDebug() << "current firmware:" << getCurrentFirmware()->getId();
QString imgDir = Helpers::getImagesCacheDir();
QDir dir(imgDir);
QTemporaryDir tempDir(QDir::tempPath() % "/etx-cpn-XXXXXX");
if (dir.exists()) {
if (!dir.removeRecursively())
qDebug() << "Unable to delete images cache directory" << imgDir;
else
qDebug() << "Deleted images cache directory" << imgDir;
if (!tempDir.isValid()) {
qDebug() << "Unable to create application temporary directory";
gAppTempPath.clear();
return finish(1);
} else {
gAppTempPath = tempDir.path();
if (!QDir(gAppTempPath).mkdir("IMAGES")) {
qDebug() << "Unable to create images cache directory:" << Helpers::getImagesCacheDir();
return finish(1);
}
}
if (!QDir::temp().mkpath(imgDir))
qDebug() << "Unable to create images cache directory" << imgDir;
else
qDebug() << "Created images cache directory" << imgDir;
qDebug() << "Created images cache directory:" << Helpers::getImagesCacheDir();
int result = 0;
SimulatorMainWindow * mainWindow = new SimulatorMainWindow(nullptr, simOptions.simulatorId, (simOptions.flags ? simOptions.flags : SIMULATOR_FLAGS_STANDALONE));