From d0e8abf2c50286733fc7c7d03d3ad752555194a0 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Tue, 31 Jan 2023 14:05:28 +0100 Subject: Versioning configuration file --- src/ochess.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/ochess.cpp') diff --git a/src/ochess.cpp b/src/ochess.cpp index 7e212f8..bf3a2ce 100644 --- a/src/ochess.cpp +++ b/src/ochess.cpp @@ -5,8 +5,21 @@ bool MyApp::OnInit() { wxImage::AddHandler(new wxPNGHandler); + // Check config version + CONFIG_OPEN(conf); + wxString version=conf->Read("version",CONFIG_VERSION); + conf->Write("version",version); // Setup config file version + wxLogDebug("Starting ochess with configuration file version %s",version); + CONFIG_CLOSE(conf); + + // Advertise for configuration file version + if(version != CONFIG_VERSION) + SHOW_DIALOG_INFO("Configuration files version missmatch. Expected "+std::string(CONFIG_VERSION)+" but got "+version+".\nPlease remove the current configuration file as it may crash the application."); + + // Main frame MainWindow *frame = new MainWindow(); frame->Show(true); + return true; } -- cgit v1.2.3