Skip to content

Commit

Permalink
only for testng
Browse files Browse the repository at this point in the history
  • Loading branch information
tzobler committed Nov 30, 2024
1 parent e97c2db commit e71515d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 49 deletions.
2 changes: 1 addition & 1 deletion cmake/tools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ macro(load_vatsim_key)
set(SWIFT_VATSIM_ID "0")
set(SWIFT_VATSIM_KEY "00000000000000000000000000000000")

if(VATSIM_KEY_JSON)
if(SWIFT_VATSIM_SUPPORT)
file(READ ${PROJECT_SOURCE_DIR}/${VATSIM_KEY_JSON} KEY_FILE)
string(JSON SWIFT_VATSIM_ID GET ${KEY_FILE} vatsim id)
string(JSON SWIFT_VATSIM_KEY GET ${KEY_FILE} vatsim key)
Expand Down
4 changes: 2 additions & 2 deletions src/misc/simulation/fscommon/fscommonutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ namespace swift::misc::simulation::fscommon
std::atomic_bool &stopped, const QString &simulatorDir)
{
Q_UNUSED(simulatorDir)
const QStringList simObjectPaths = CFsDirectories::msfsSimObjectsDirPlusAddOnXmlSimObjectsPaths();
const QStringList simObjectPaths = CFsDirectories::msfsSimObjectsDirPath();
return CFsCommonUtil::validateSimObjectsPath(QSet<QString>(simObjectPaths.begin(), simObjectPaths.end()),
models, validModels, invalidModels, ignoreEmptyFileNames,
stopAtFailedFiles, stopped);
Expand Down Expand Up @@ -283,7 +283,7 @@ namespace swift::misc::simulation::fscommon
if (!ok)
{
msgs.push_back(CStatusMessage(static_cast<CFsCommonUtil *>(nullptr))
.validationWarning(u"Model '%1' '%2' in none of the %3 SimObjects path(s)")
.validationWarning(u"Model '%1' '%2' in none of the %3 SimObjects path(s) %3 ")
<< model.getModelString() << model.getFileName() << simObjectDirs.size());
failed++;
}
Expand Down
49 changes: 6 additions & 43 deletions src/misc/simulation/fscommon/fsdirectories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace swift::misc::simulation::fscommon
return dir;
}

QString msfsDirImpl()
static QString msfsDirImpl()
{
const QStringList locations = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
for (const QString &path : locations)
Expand Down Expand Up @@ -323,22 +323,12 @@ namespace swift::misc::simulation::fscommon
return allPaths;
}

QStringList CFsDirectories::msfsSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir)
// TODO TZ this function needs to be adjusted
// QStringList CFsDirectories::msfsSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir) // changed name
QStringList CFsDirectories::msfsSimObjectsDirPath(const QString &simObjectsDir)
{
// finding the user settings only works on P3D machine
QStringList allPaths = CFsDirectories::allMsfsSimObjectPaths().values();
const QString sod = CFileUtils::normalizeFilePathToQtStandard(
simObjectsDir.isEmpty() ? CFsDirectories::msfsSimObjectsDir() : simObjectsDir);
if (!sod.isEmpty() && !allPaths.contains(sod, Qt::CaseInsensitive))
{
// case insensitive is important here
allPaths.push_front(sod);
}

allPaths.removeAll({}); // remove all empty
allPaths.removeDuplicates();
allPaths.sort(Qt::CaseInsensitive);
return allPaths;
static const QStringList Path { "F:/MSFSPackages" };
return Path;
}

QStringList CFsDirectories::p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir,
Expand Down Expand Up @@ -630,11 +620,6 @@ namespace swift::misc::simulation::fscommon
return CFsDirectories::fsxSimObjectsPaths(CFsDirectories::findFsxConfigFiles(), true);
}

QSet<QString> CFsDirectories::allMsfsSimObjectPaths()
{
return CFsDirectories::msfsSimObjectsPaths(CFsDirectories::findMsfsConfigFiles(), true);
}

QStringList CFsDirectories::findFsxConfigFiles()
{
const QStringList locations = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
Expand All @@ -656,28 +641,6 @@ namespace swift::misc::simulation::fscommon
return files;
}

QStringList CFsDirectories::findMsfsConfigFiles()
{
const QStringList locations = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
QStringList files;
for (const QString &path : locations)
{
// TODO this acts as a placeholder. the file msfs.cfg doesn't exist
const QString file = CFileUtils::appendFilePaths(CFileUtils::pathUp(path), "Microsoft/MSFS/msfs.cfg");
const QFileInfo fi(file);
if (fi.exists())
{
files.push_back(fi.absoluteFilePath());
if (logConfigPathReading())
{
CLogMessage(static_cast<CFsDirectories *>(nullptr)).info(u"MSFS config file: '%1'")
<< fi.absoluteFilePath();
}
}
}
return files;
}

QSet<QString> CFsDirectories::fsxSimObjectsPaths(const QStringList &fsxFiles, bool checked)
{
QSet<QString> paths;
Expand Down
8 changes: 5 additions & 3 deletions src/misc/simulation/fscommon/fsdirectories.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace swift::misc::simulation::fscommon
static QStringList fsxSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir = "");

//! MSFS's simObject dir and the add on dirs
static QStringList msfsSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir = "");
static QStringList msfsSimObjectsDirPath(const QString &simObjectsDir = "");

//! P3D's simObject dir and the add on dirs
static QStringList p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir,
Expand Down Expand Up @@ -132,16 +132,18 @@ namespace swift::misc::simulation::fscommon
//! Get all the SimObjects paths from all config files
static QSet<QString> allFsxSimObjectPaths();

// TODO TZ
//! Get all the SimObjects paths from all config files
static QSet<QString> allMsfsSimObjectPaths();
// static QSet<QString> allMsfsSimObjectPaths();

//! Find the config files (fsx.cfg)
// C:/Users/Joe Doe/AppData/Roaming/Microsoft/FSX/fsx.cfg
static QStringList findFsxConfigFiles();

// TODO TZ
//! Find the config files (fsx.cfg)
// C:/Users/Joe Doe/AppData/Roaming/Microsoft/FSX/fsx.cfg
static QStringList findMsfsConfigFiles();
// static QStringList findMsfsConfigFiles();

//! Get all the SimObjects paths from fsx.cfg
// SimObjectPaths.0=SimObjects\Airplanes
Expand Down

0 comments on commit e71515d

Please sign in to comment.