Minor performance improvement of subdir check

* follow T689
* no need to always get and init simulator directory as it will not change
This commit is contained in:
Klaus Basan
2019-06-30 15:56:28 +02:00
committed by Mat Sutcliffe
parent 3dde201df0
commit 58b7c875bc
3 changed files with 23 additions and 4 deletions

View File

@@ -567,11 +567,16 @@ namespace BlackSimPlugin
if (package.isEmpty()) { continue; }
packages.insert(it, { package.append('/') });
}
// comment KB 2019-06
// a package is one xsb_aircraft.txt file BB has 9, X-CSL has 76
// the reason for the append("/")/chop "/" is explained here: https://discordapp.com/channels/539048679160676382/539925070550794240/594891288751505418
const QDir simDir = getSimulatorSettings().getSimulatorDirectoryOrDefault();
for (auto &package : packages)
{
Q_ASSERT(package.s.endsWith('/'));
package.s.chop(1);
if (CDirectoryUtils::isSubDirectoryOf(package.s, getSimulatorSettings().getSimulatorDirectoryOrDefault()))
if (CDirectoryUtils::isSubDirectoryOf(package.s, simDir))
{
m_trafficProxy->loadPlanesPackage(package.s);
}