Skip to content

Commit

Permalink
Check for platform duplicates (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gemba authored Nov 26, 2024
1 parent fc029eb commit c96bd86
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down Expand Up @@ -119,6 +125,7 @@ QString Platform::getFormats(QString platform, QString extensions,
return extensions;
}

// default extensions/formats for all
QSet<QString> formats({"*.zip", "*.7z", "*.ml"});
QStringList addExts;

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit c96bd86

Please sign in to comment.