Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061From a80a739163d2013ec400223a68a387f4f9297b2a Mon Sep 17 00:00:00 2001From: Nikolay Korotkiy <sikmir@gmail.com>Date: Fri, 29 Oct 2021 01:38:21 +0300Subject: [PATCH] Fix sdrpp breaking every time the package is rebuilt.
On NixOS, the INSTALL_PREFIX changes on every rebuild to the package, but sdrppfills it in as part of the default config and then installs that configto the users home folder. Fix this by not substituting @INSTALL_PREFIX@ in thedefault config until runtime.--- core/src/core.cpp | 8 ++++++-- core/src/gui/main_window.cpp | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/core/src/core.cpp b/core/src/core.cppindex 9546e60..98d6065 100644--- a/core/src/core.cpp+++ b/core/src/core.cpp@@ -242,8 +242,8 @@ int sdrpp_main(int argc, char *argv[]) { defConfig["modulesDirectory"] = "./modules"; defConfig["resourcesDirectory"] = "./res"; #else- defConfig["modulesDirectory"] = INSTALL_PREFIX "/lib/sdrpp/plugins";- defConfig["resourcesDirectory"] = INSTALL_PREFIX "/share/sdrpp";+ defConfig["modulesDirectory"] = "@prefix@/lib/sdrpp/plugins";+ defConfig["resourcesDirectory"] = "@prefix@/share/sdrpp"; #endif // Load config@@ -290,6 +290,10 @@ int sdrpp_main(int argc, char *argv[]) { int winHeight = core::configManager.conf["windowSize"]["h"]; maximized = core::configManager.conf["maximized"]; std::string resDir = core::configManager.conf["resourcesDirectory"];+ {+ std::size_t pos = resDir.find("@prefix@");+ if (pos != std::string::npos) resDir.replace(pos, 8, INSTALL_PREFIX);+ } json bandColors = core::configManager.conf["bandColors"]; core::configManager.release(); diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cppindex 954dbd6..52f0eed 100644--- a/core/src/gui/main_window.cpp+++ b/core/src/gui/main_window.cpp@@ -44,6 +44,12 @@ void MainWindow::init() { json menuElements = core::configManager.conf["menuElements"]; std::string modulesDir = core::configManager.conf["modulesDirectory"]; std::string resourcesDir = core::configManager.conf["resourcesDirectory"];+ {+ std::size_t pos = modulesDir.find("@prefix@");+ if (pos != std::string::npos) modulesDir.replace(pos, 8, INSTALL_PREFIX);+ pos = resourcesDir.find("@prefix@");+ if (pos != std::string::npos) resourcesDir.replace(pos, 8, INSTALL_PREFIX);+ } core::configManager.release(); // Load menu elements-- 2.33.0