Add settings to control the if prism should move the downloaded mods

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2024-12-20 19:57:09 +02:00
parent 0b6ce5525d
commit 7dde35fef2
6 changed files with 51 additions and 17 deletions

View File

@ -288,6 +288,8 @@ void BlockedModsDialog::checkMatchHash(QString hash, QString path)
qDebug() << "[Blocked Mods Dialog] Checking for match on hash: " << hash << "| From path:" << path;
auto downloadDir = QFileInfo(APPLICATION->settings()->get("DownloadsDir").toString()).absoluteFilePath();
auto moveFiles = APPLICATION->settings()->get("MoveModsFromDownloadsDir").toBool();
for (auto& mod : m_mods) {
if (mod.matched) {
continue;
@ -295,6 +297,9 @@ void BlockedModsDialog::checkMatchHash(QString hash, QString path)
if (mod.hash.compare(hash, Qt::CaseInsensitive) == 0) {
mod.matched = true;
mod.localPath = path;
if (moveFiles) {
mod.move = QFileInfo(path).absoluteFilePath().startsWith(downloadDir);
}
match = true;
qDebug() << "[Blocked Mods Dialog] Hash match found:" << mod.name << hash << "| From path:" << path;
@ -346,6 +351,8 @@ bool BlockedModsDialog::checkValidPath(QString path)
return fsName.compare(metaName) == 0;
};
auto downloadDir = QFileInfo(APPLICATION->settings()->get("DownloadsDir").toString()).absoluteFilePath();
auto moveFiles = APPLICATION->settings()->get("MoveModsFromDownloadsDir").toBool();
for (auto& mod : m_mods) {
if (compare(filename, mod.name)) {
// if the mod is not yet matched and doesn't have a hash then
@ -353,6 +360,9 @@ bool BlockedModsDialog::checkValidPath(QString path)
if (!mod.matched && mod.hash.isEmpty()) {
mod.matched = true;
mod.localPath = path;
if (moveFiles) {
mod.move = QFileInfo(path).absoluteFilePath().startsWith(downloadDir);
}
return false;
}
qDebug() << "[Blocked Mods Dialog] Name match found:" << mod.name << "| From path:" << path;