diff --git a/lib/src/oclero/QtUpdater.cpp b/lib/src/oclero/QtUpdater.cpp index c49b3ef..b1de167 100644 --- a/lib/src/oclero/QtUpdater.cpp +++ b/lib/src/oclero/QtUpdater.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -27,26 +28,6 @@ Q_LOGGING_CATEGORY(CATEGORY_UPDATER, "oclero.qtupdater") #endif namespace utils { -void clearDirectoryContent(const QString& dirPath, const QStringList& extensionFilter = {}) { - QDir dir(dirPath); - if (!dir.exists()) { - return; - } - - const auto& entryInfoList = extensionFilter.isEmpty() - ? dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden) - : dir.entryInfoList(extensionFilter, QDir::Files | QDir::Hidden); - for (const auto& entryInfo : entryInfoList) { - const auto entryAbsPath = entryInfo.absoluteFilePath(); - if (entryInfo.isDir()) { - QDir subDir(entryAbsPath); - subDir.removeRecursively(); - } else { - dir.remove(entryAbsPath); - } - } -} - QString getDefaultTemporaryDirectoryPath() { QString result; @@ -470,7 +451,7 @@ struct QtUpdater::Impl { const auto allFilesExist = localChangelog.exists() && localChangelog.isFile() && localInstaller.exists() && localInstaller.isFile(); if (!allFilesExist) { - utils::clearDirectoryContent(downloadsDir); + oclero::clearDirectoryContent(downloadsDir); return UpdateInfo{}; } @@ -523,7 +504,7 @@ struct QtUpdater::Impl { // If the most recent is the one from the server, // wipe existing files because there are obsolete. if (update == &onlineUpdateInfo) { - utils::clearDirectoryContent(downloadsDir); + oclero::clearDirectoryContent(downloadsDir); // Write downloaded JSON to disk. const auto [success, saveJSONFilePath] = update->json.saveToFile(downloadsDir); diff --git a/submodules/qtutils b/submodules/qtutils index 477d652..82fef45 160000 --- a/submodules/qtutils +++ b/submodules/qtutils @@ -1 +1 @@ -Subproject commit 477d65211a15bffabe11d9f0b526c917893ae8ee +Subproject commit 82fef4504bf179f6d0629e9ba190f87faea1e5bf