App: Get Addon name from Metadata
This commit is contained in:
committed by
Max Wilfinger
parent
8f2a3a4d7d
commit
a4a1ef7294
@@ -3556,14 +3556,18 @@ void Application::addModuleInfo(QTextStream& str, const QString& modPath, bool&
|
||||
firstMod = false;
|
||||
str << "Installed mods: \n";
|
||||
}
|
||||
str << " * " << (mod.isDir() ? QDir(modPath).dirName() : mod.fileName());
|
||||
QString addonName = mod.isDir() ? QDir(modPath).dirName() : mod.fileName();
|
||||
QString versionString;
|
||||
try {
|
||||
auto metadataFile =
|
||||
std::filesystem::path(mod.absoluteFilePath().toStdString()) / "package.xml";
|
||||
if (std::filesystem::exists(metadataFile)) {
|
||||
App::Metadata metadata(metadataFile);
|
||||
if (!metadata.name().empty()) {
|
||||
addonName = QString::fromStdString(metadata.name());
|
||||
}
|
||||
if (metadata.version() != App::Meta::Version()) {
|
||||
str << QLatin1String(" ") + QString::fromStdString(metadata.version().str());
|
||||
versionString = QString::fromStdString(" " + metadata.version().str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3572,6 +3576,7 @@ void Application::addModuleInfo(QTextStream& str, const QString& modPath, bool&
|
||||
QChar::fromLatin1(' '));
|
||||
str << " (Malformed metadata: " << what << ")";
|
||||
}
|
||||
str << " * " << addonName << versionString;
|
||||
QFileInfo disablingFile(mod.absoluteFilePath(), QStringLiteral("ADDON_DISABLED"));
|
||||
if (disablingFile.exists()) {
|
||||
str << " (Disabled)";
|
||||
|
||||
Reference in New Issue
Block a user