Make the new FL2 flux format the default.

This commit is contained in:
dg
2021-12-05 17:09:02 +00:00
parent 930e0bcd67
commit 27fceb3f41
7 changed files with 19 additions and 11 deletions

View File

@@ -50,6 +50,13 @@ private:
std::unique_ptr<FluxSource> FluxSource::createFl2FluxSource(const Fl2FluxSourceProto& config)
{
char buffer[16];
std::ifstream(config.filename(), std::ios::in | std::ios::binary).read(buffer, 16);
if (strncmp(buffer, "SQLite format 3", 16) == 0)
{
std::cerr << "Warning: reading a deprecated flux file format; please upgrade it\n";
return FluxSource::createSqliteFluxSource(config.filename());
}
return std::unique_ptr<FluxSource>(new Fl2FluxSource(config));
}

View File

@@ -50,12 +50,12 @@ std::unique_ptr<FluxSource> FluxSource::create(const FluxSourceProto& config)
void FluxSource::updateConfigForFilename(FluxSourceProto* proto, const std::string& filename)
{
static const std::vector<std::pair<std::regex, std::function<void(const std::string&)>>> formats =
{
{ std::regex("^(.*\\.flux)$"), [&](const auto& s) { proto->set_fluxfile(s); }},
{ std::regex("^(.*\\.flux)$"), [&](const auto& s) { proto->mutable_fl2()->set_filename(s); }},
{ std::regex("^(.*\\.scp)$"), [&](const auto& s) { proto->mutable_scp()->set_filename(s); }},
{ std::regex("^(.*\\.cwf)$"), [&](const auto& s) { proto->mutable_cwf()->set_filename(s); }},
{ std::regex("^(.*\\.fl2)$"), [&](const auto& s) { proto->mutable_fl2()->set_filename(s); }},
{ std::regex("^erase:$"), [&](const auto& s) { proto->mutable_erase(); }},
{ std::regex("^kryoflux:(.*)$"), [&](const auto& s) { proto->mutable_kryoflux()->set_directory(s); }},
{ std::regex("^testpattern:(.*)"), [&](const auto& s) { proto->mutable_test_pattern(); }},