Ref T199, do not use hardcoded names of file names

This commit is contained in:
Klaus Basan
2018-01-13 04:57:42 +01:00
parent f0d2336eb6
commit 1b1c4e588c
2 changed files with 19 additions and 5 deletions

View File

@@ -165,12 +165,21 @@ namespace BlackGui
if (ui->rb_Cache->isChecked())
{
// only copy setup and model caches
static const QStringList cacheFilter(
static const QStringList cacheFilter = [ = ]
{
"modelset*.json",
"modelcache*.json",
"*setup.json"
});
QStringList cf({
m_modelSetCurrentSimulator.getFilename(),
m_modelsCurrentSimulator.getFilename(),
m_launcherSetup.getFilename(),
m_vatsimSetup.getFilename(),
m_lastVatsimServer.getFilename(),
m_lastServer.getFilename(),
m_lastAircraftModel.getFilename()
});
cf.append(m_modelSetCaches.getAllFilenames());
cf.append(m_modelCaches.getAllFilenames());
return CFileUtils::getFileNamesOnly(cf);
}();
if (!m_withBootstrapFile) { return cacheFilter; }
static const QStringList cacheFilterBs = [ = ]

View File

@@ -16,6 +16,8 @@
#include "blackcore/data/launchersetup.h"
#include "blackcore/data/vatsimsetup.h"
#include "blackmisc/simulation/data/modelcaches.h"
#include "blackmisc/simulation/data/lastmodel.h"
#include "blackmisc/network/data/lastserver.h"
#include <QFrame>
#include <QWizardPage>
#include <QDir>
@@ -126,10 +128,13 @@ namespace BlackGui
// caches will be initialized so they can be overriden
// those caches do not harm if they exists default initialized
//! \fixme this is a workaround, as it creates files on disk even if those are not copied. It was much nicer if the cache would init themself if the file appears
BlackMisc::CData<BlackMisc::Network::Data::TLastServer> m_lastServer { this }; //!< recently used server (VATSIM, other)
BlackMisc::CData<BlackMisc::Simulation::Data::TModelSetLastSelection> m_modelSetCurrentSimulator { this };
BlackMisc::CData<BlackMisc::Simulation::Data::TModelCacheLastSelection> m_modelsCurrentSimulator { this };
BlackMisc::CData<BlackMisc::Simulation::Data::TLastModel> m_lastAircraftModel { this }; //!< recently used aircraft model
BlackMisc::CData<BlackCore::Data::TLauncherSetup> m_launcherSetup { this };
BlackMisc::CData<BlackCore::Data::TVatsimSetup> m_vatsimSetup { this };
BlackMisc::CData<BlackCore::Data::TVatsimLastServer> m_lastVatsimServer { this }; //!< recently used VATSIM server
};
/**