From c5969b0434ccca1d39fe969fd11269e4cc06dc51 Mon Sep 17 00:00:00 2001 From: Uwe Risse Date: Mon, 23 Oct 2023 20:59:39 +0200 Subject: [PATCH] Backup the libhamlib-4.dll file, so it is available after a program update. --- widgets/mainwindow.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 0067f5765..f23092c75 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -1084,6 +1084,13 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, QString jpleph = m_config.data_dir().absoluteFilePath("JPLEPH"); jpl_setup_(const_cast(jpleph.toLocal8Bit().constData()),256); +#ifdef WIN32 + // backup libhamlib-4.dll file, so it is still available after the next program update + QDir dataPath = QCoreApplication::applicationDirPath(); + QFile f {dataPath.absolutePath() + "/" + "libhamlib-4_old.dll"}; + if (!f.exists()) QFile::copy(dataPath.absolutePath() + "/" + "libhamlib-4.dll", dataPath.absolutePath() + "/" + "libhamlib-4_old.dll"); +#endif + // this must be the last statement of constructor if (!m_valid) throw std::runtime_error {"Fatal initialization exception"}; }