From c96bd86b4272af0356ad820eede45a3ce8cf9ee3 Mon Sep 17 00:00:00 2001 From: Gemba Date: Tue, 26 Nov 2024 13:18:33 +0100 Subject: [PATCH] Check for platform duplicates (#94) --- src/platform.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/platform.cpp b/src/platform.cpp index e80f96b0..4c47a685 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -74,6 +74,12 @@ bool Platform::loadConfig() { for (auto plit = jObjLocal.constBegin(); plit != jObjLocal.constEnd(); plit++) { + if (jObj.contains(plit.key())) { + printf("\033[1;33mWARNING: Duplicate JSON Object key detected " + "'%s'. Skyscraper will continue and use last found object. " + "Remove duplicate to rectify the issue.\033[0m\n", + plit.key().toUtf8().constData()); + } jObj.insert(plit.key(), plit.value()); } @@ -119,6 +125,7 @@ QString Platform::getFormats(QString platform, QString extensions, return extensions; } + // default extensions/formats for all QSet formats({"*.zip", "*.7z", "*.ml"}); QStringList addExts; @@ -212,6 +219,14 @@ bool Platform::loadPlatformsIdMap() { } i++; } + if (platformIdsMap.contains(pkey)) { + printf("\033[1;33mWARNING: Duplicate platform key detected '%s' in " + "'%s'. Skyscraper will continue and uses values of that " + "platform (%s). Remove duplicate to rectify the " + "issue.\033[0m\n", + pkey.toUtf8().constData(), fn.toUtf8().constData(), + parts.join(',').toUtf8().constData()); + } platformIdsMap.insert(pkey, ids); } configFile.close();