mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
refs #619, allow exclude dirs in file utils searches for newest files
This commit is contained in:
@@ -148,8 +148,7 @@ namespace BlackMisc
|
||||
{
|
||||
const QDateTime cacheTs(getCacheTimestamp());
|
||||
if (!cacheTs.isValid()) { return true; }
|
||||
//! \todo KB we cannot use the exclude dirs, a minor disadvantege. Also wonder if it was better to parse a QStringList ofr wildcard
|
||||
return CFileUtils::containsFileNewerThan(cacheTs, this->getRootDirectory(), true, "*.cfg");
|
||||
return CFileUtils::containsFileNewerThan(cacheTs, this->getRootDirectory(), true, { fileFilter() }, this->m_excludedDirectories);
|
||||
}
|
||||
|
||||
bool CAircraftCfgParser::hasCachedData() const
|
||||
@@ -223,19 +222,15 @@ namespace BlackMisc
|
||||
if (m_cancelLoading) { return CAircraftCfgEntriesList(); }
|
||||
|
||||
// excluded?
|
||||
for (const auto &excludeDir : excludeDirectories)
|
||||
if (CFileUtils::isExcludedDirectory(directory, excludeDirectories))
|
||||
{
|
||||
if (m_cancelLoading) { return CAircraftCfgEntriesList(); }
|
||||
if (directory.contains(excludeDir, Qt::CaseInsensitive))
|
||||
{
|
||||
CLogMessage(this).debug() << "Skipping directory " << directory;
|
||||
*ok = true;
|
||||
return CAircraftCfgEntriesList();
|
||||
}
|
||||
CLogMessage(this).debug() << "Skipping directory " << directory;
|
||||
*ok = true;
|
||||
return CAircraftCfgEntriesList();
|
||||
}
|
||||
|
||||
// set directory with name filters, get aircraft.cfg and sub directories
|
||||
QDir dir(directory, "aircraft.cfg", QDir::Name, QDir::Files | QDir::AllDirs);
|
||||
QDir dir(directory, fileFilter(), QDir::Name, QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot);
|
||||
if (!dir.exists())
|
||||
{
|
||||
*ok = true;
|
||||
@@ -446,6 +441,12 @@ namespace BlackMisc
|
||||
return content;
|
||||
}
|
||||
|
||||
const QString &CAircraftCfgParser::fileFilter()
|
||||
{
|
||||
static const QString f("aircraft.cfg");
|
||||
return f;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -94,10 +94,12 @@ namespace BlackMisc
|
||||
CAircraftCfgEntriesList m_parsedCfgEntriesList; //!< parsed entries
|
||||
QPointer<BlackMisc::CWorker> m_parserWorker; //!< worker will destroy itself, so weak pointer
|
||||
|
||||
//! \todo KB/MS Is there nothing better than having 3 cache members
|
||||
//! \todo KB/MS Is there nothing better than having 3 cache members?
|
||||
BlackMisc::CData<BlackMisc::Simulation::Data::ModelCacheFsx> m_modelCacheFsx {this}; //!< FSX cache
|
||||
BlackMisc::CData<BlackMisc::Simulation::Data::ModelCacheFs9> m_modelCacheFs9 {this}; //!< Fs9 cache
|
||||
BlackMisc::CData<BlackMisc::Simulation::Data::ModelCacheP3D> m_modelCacheP3D {this}; //!< P3D cache
|
||||
|
||||
static const QString &fileFilter();
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user