mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 11:25:33 +08:00
Log all FSX/P3D config files read
This commit is contained in:
committed by
Mat Sutcliffe
parent
a5a6a111e1
commit
25dc43f19c
@@ -11,6 +11,7 @@
|
|||||||
#include "blackmisc/directoryutils.h"
|
#include "blackmisc/directoryutils.h"
|
||||||
#include "blackmisc/fileutils.h"
|
#include "blackmisc/fileutils.h"
|
||||||
#include "blackmisc/stringutils.h"
|
#include "blackmisc/stringutils.h"
|
||||||
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackconfig/buildconfig.h"
|
#include "blackconfig/buildconfig.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -435,9 +436,13 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
const QString f = CFileUtils::appendFilePaths(d.absolutePath(), entry, configFile);
|
const QString f = CFileUtils::appendFilePaths(d.absolutePath(), entry, configFile);
|
||||||
const QFileInfo fi(f);
|
const QFileInfo fi(f);
|
||||||
if (fi.exists()) { files.insert(f); }
|
if (fi.exists())
|
||||||
}
|
{
|
||||||
}
|
files.insert(f);
|
||||||
|
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"P3D config file: '%1'") << f; }
|
||||||
|
}
|
||||||
|
} // contains
|
||||||
|
} // entries
|
||||||
}
|
}
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
@@ -485,9 +490,15 @@ namespace BlackMisc
|
|||||||
const QDomElement path = component.firstChildElement("Path");
|
const QDomElement path = component.firstChildElement("Path");
|
||||||
const QString pathValue = path.text();
|
const QString pathValue = path.text();
|
||||||
if (pathValue.isEmpty()) { continue; }
|
if (pathValue.isEmpty()) { continue; }
|
||||||
if (!checked || QDir(pathValue).exists()) { simObjectPaths.insert(CFileUtils::normalizeFilePathToQtStandard(pathValue)); }
|
if (!checked || QDir(pathValue).exists())
|
||||||
}
|
{
|
||||||
}
|
const QString path = CFileUtils::normalizeFilePathToQtStandard(pathValue);
|
||||||
|
simObjectPaths.insert(path);
|
||||||
|
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"P3D SimObjects path: '%1'") << path; }
|
||||||
|
}
|
||||||
|
} // components
|
||||||
|
} // paths
|
||||||
|
|
||||||
return simObjectPaths;
|
return simObjectPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,7 +537,11 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
const QString file = CFileUtils::appendFilePaths(CFileUtils::pathUp(path), "Microsoft/FSX/fsx.cfg");
|
const QString file = CFileUtils::appendFilePaths(CFileUtils::pathUp(path), "Microsoft/FSX/fsx.cfg");
|
||||||
const QFileInfo fi(file);
|
const QFileInfo fi(file);
|
||||||
if (fi.exists()) { files.push_back(fi.absoluteFilePath()); }
|
if (fi.exists())
|
||||||
|
{
|
||||||
|
files.push_back(fi.absoluteFilePath());
|
||||||
|
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"FSX config file: '%1'") << fi.absoluteFilePath(); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
@@ -560,14 +575,10 @@ namespace BlackMisc
|
|||||||
const QFileInfo fi(soPath);
|
const QFileInfo fi(soPath);
|
||||||
|
|
||||||
// relative or absolute paths
|
// relative or absolute paths
|
||||||
if (fi.isAbsolute() && (!checked || fi.exists()))
|
const QString p = (fi.isAbsolute() && (!checked || fi.exists())) ?
|
||||||
{
|
fi.absolutePath() : soPath;
|
||||||
paths.insert(fi.absolutePath());
|
paths.insert(p);
|
||||||
}
|
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"FSX SimObjects path: '%1'") << p; }
|
||||||
else
|
|
||||||
{
|
|
||||||
paths.insert(soPath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
@@ -701,6 +712,11 @@ namespace BlackMisc
|
|||||||
|
|
||||||
return msgs;
|
return msgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CFsCommonUtil::logConfigPathReading()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -157,6 +157,9 @@ namespace BlackMisc
|
|||||||
//! Validate if known SimObjects path are used
|
//! Validate if known SimObjects path are used
|
||||||
//! \remark only for P3D
|
//! \remark only for P3D
|
||||||
static CStatusMessageList validateSimObjectsPath(const QSet<QString> &simObjectDirs, const CAircraftModelList &models, CAircraftModelList &validModels, CAircraftModelList &invalidModels, bool ignoreEmptyFileNames, int stopAtFailedFiles, bool &stopped);
|
static CStatusMessageList validateSimObjectsPath(const QSet<QString> &simObjectDirs, const CAircraftModelList &models, CAircraftModelList &validModels, CAircraftModelList &invalidModels, bool ignoreEmptyFileNames, int stopAtFailedFiles, bool &stopped);
|
||||||
|
|
||||||
|
//! Log the reading of config files
|
||||||
|
static bool logConfigPathReading();
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user