Qt: Add cache dir call, for later expansion

This commit is contained in:
Vicki Pfau 2022-10-31 19:45:38 -07:00
parent 472660a5d3
commit 9ed00c95b6
4 changed files with 7 additions and 2 deletions

View File

@ -136,7 +136,7 @@ QUrl ApplicationUpdater::parseManifest(const QByteArray& manifest) {
QString ApplicationUpdater::destination() const { QString ApplicationUpdater::destination() const {
QFileInfo path(updateInfo().url.path()); QFileInfo path(updateInfo().url.path());
QDir dir(ConfigController::configDir()); QDir dir(ConfigController::cacheDir());
// QFileInfo::completeSuffix will eat all .'s in the filename...including // QFileInfo::completeSuffix will eat all .'s in the filename...including
// ones in the version string, turning mGBA-1.0.0-win32.7z into // ones in the version string, turning mGBA-1.0.0-win32.7z into
// 0.0-win32.7z instead of the intended .7z // 0.0-win32.7z instead of the intended .7z

View File

@ -382,3 +382,7 @@ const QString& ConfigController::configDir() {
} }
return s_configDir; return s_configDir;
} }
const QString& ConfigController::cacheDir() {
return configDir();
}

View File

@ -105,6 +105,7 @@ public:
void usage(const char* arg0) const; void usage(const char* arg0) const;
static const QString& configDir(); static const QString& configDir();
static const QString& cacheDir();
static bool isPortable(); static bool isPortable();
public slots: public slots:

View File

@ -78,7 +78,7 @@ void ForwarderController::gotManifest(QNetworkReply* reply) {
void ForwarderController::downloadBuild(const QUrl& url) { void ForwarderController::downloadBuild(const QUrl& url) {
QString extension(QFileInfo(url.path()).suffix()); QString extension(QFileInfo(url.path()).suffix());
// TODO: cache this // TODO: cache this
QString configDir(ConfigController::configDir()); QString configDir(ConfigController::cacheDir());
m_sourceFile.setFileName(QString("%1/%2-%3-%4.%5").arg(configDir) m_sourceFile.setFileName(QString("%1/%2-%3-%4.%5").arg(configDir)
.arg(projectName) .arg(projectName)
.arg(m_generator->systemName()) .arg(m_generator->systemName())