@@ -534,6 +534,40 @@ void AboutDialog::linkActivated(const QUrl& link)
534534 licenseView->setSource (link);
535535}
536536
537+ void AboutDialog::addModuleInfo (QTextStream& str, const QString& modPath, bool & firstMod)
538+ {
539+ QFileInfo mod (modPath);
540+ if (mod.isHidden ()) { // Ignore hidden directories
541+ return ;
542+ }
543+ if (firstMod) {
544+ firstMod = false ;
545+ str << " Installed mods: \n " ;
546+ }
547+ str << " * " << (mod.isDir () ? QDir (modPath).dirName () : mod.fileName ());
548+ try {
549+ auto metadataFile =
550+ boost::filesystem::path (mod.absoluteFilePath ().toStdString ()) / " package.xml" ;
551+ if (boost::filesystem::exists (metadataFile)) {
552+ App::Metadata metadata (metadataFile);
553+ if (metadata.version () != App::Meta::Version ()) {
554+ str << QLatin1String (" " ) + QString::fromStdString (metadata.version ().str ());
555+ }
556+ }
557+ }
558+ catch (const Base::Exception& e) {
559+ auto what = QString::fromUtf8 (e.what ()).trimmed ().replace (QChar::fromLatin1 (' \n ' ),
560+ QChar::fromLatin1 (' ' ));
561+ str << " (Malformed metadata: " << what << " )" ;
562+ }
563+ QFileInfo disablingFile (mod.absoluteFilePath (), QString::fromLatin1 (" ADDON_DISABLED" ));
564+ if (disablingFile.exists ()) {
565+ str << " (Disabled)" ;
566+ }
567+
568+ str << " \n " ;
569+ }
570+
537571void AboutDialog::copyToClipboard ()
538572{
539573 QString data;
@@ -680,28 +714,16 @@ void AboutDialog::copyToClipboard()
680714 bool firstMod = true ;
681715 if (fs::exists (modDir) && fs::is_directory (modDir)) {
682716 for (const auto & mod : fs::directory_iterator (modDir)) {
683- auto dirName = mod.path ().filename ().string ();
684- if (dirName[0 ] == ' .' ) { // Ignore dot directories
685- continue ;
686- }
687- if (firstMod) {
688- firstMod = false ;
689- str << " Installed mods: \n " ;
690- }
691- str << " * " << QString::fromStdString (mod.path ().filename ().string ());
692- auto metadataFile = mod.path () / " package.xml" ;
693- if (fs::exists (metadataFile)) {
694- App::Metadata metadata (metadataFile);
695- if (metadata.version () != App::Meta::Version ()) {
696- str << QLatin1String (" " ) + QString::fromStdString (metadata.version ().str ());
697- }
698- }
699- auto disablingFile = mod.path () / " ADDON_DISABLED" ;
700- if (fs::exists (disablingFile)) {
701- str << " (Disabled)" ;
702- }
717+ auto dirName = mod.path ().string ();
718+ addModuleInfo (str, QString::fromStdString (dirName), firstMod);
719+ }
720+ }
721+ auto additionalModules = config.find (" AdditionalModulePaths" );
703722
704- str << " \n " ;
723+ if (additionalModules != config.end ()) {
724+ auto mods = QString::fromStdString (additionalModules->second ).split (QChar::fromLatin1 (' ;' ));
725+ for (const auto & mod : mods) {
726+ addModuleInfo (str, mod, firstMod);
705727 }
706728 }
707729
0 commit comments