refs #747 It must be possible to load CSL models from a user-supplied directory.

This commit is contained in:
Mathew Sutcliffe
2016-08-28 02:18:38 +01:00
parent 80dc4ea49a
commit 520f593d51
3 changed files with 12 additions and 4 deletions

View File

@@ -138,7 +138,8 @@ namespace BlackMisc
CAircraftModelList CAircraftModelLoaderXPlane::performParsing(const QString &rootDirectory, const QStringList &excludeDirectories)
{
CAircraftModelList allModels;
allModels.push_back(parseCslPackages(CXPlaneUtil::xbusLegacyDir(), excludeDirectories));
allModels.push_back(parseCslPackages(CXPlaneUtil::xbusLegacyDir(rootDirectory), excludeDirectories));
allModels.push_back(parseCslPackages(rootDirectory, excludeDirectories));
allModels.push_back(parseFlyableAirplanes(rootDirectory, excludeDirectories));
return allModels;
}

View File

@@ -113,10 +113,18 @@ namespace BlackMisc
return QStringList();
}
QString CXPlaneUtil::xbusLegacyDir()
QString CXPlaneUtil::xbusLegacyDir(const QString &rootDir)
{
QString legacyPath("/Resources/plugins/xbus/LegacyData");
// Return the first non empty path, we can find.
if (!rootDir.isEmpty())
{
QString xbusLegacy = rootDir + legacyPath;
if (QDir(xbusLegacy).exists())
{
return xbusLegacy;
}
}
if (!xplane10Dir().isEmpty())
{
QString xbusLegacy = xplane10Dir() + legacyPath;
@@ -125,7 +133,6 @@ namespace BlackMisc
return xbusLegacy;
}
}
if (!xplane9Dir().isEmpty())
{
QString xbusLegacy = xplane9Dir() + legacyPath;

View File

@@ -48,7 +48,7 @@ namespace BlackMisc
static QStringList xplaneModelExcludeDirectoryPatterns();
//! XBus legacy directory
static QString xbusLegacyDir();
static QString xbusLegacyDir(const QString &rootDir);
};
} // namespace
} // namespace