Skip to content

Commit

Permalink
Update submodule QtUtils to v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
oclero committed Dec 27, 2022
1 parent 54c2a50 commit cdcc2ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
25 changes: 3 additions & 22 deletions lib/src/oclero/QtUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <oclero/QtEnumUtils.hpp>
#include <oclero/QtSettingsUtils.hpp>
#include <oclero/QtFileUtils.hpp>

#include <QLoggingCategory>
#include <QFile>
Expand All @@ -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;

Expand Down Expand Up @@ -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{};
}

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion submodules/qtutils

0 comments on commit cdcc2ed

Please sign in to comment.