mirror of
				https://github.com/AlexandreRouma/SDRPlusPlus.git
				synced 2025-10-31 17:08:13 +01:00 
			
		
		
		
	Fixed weird bug where config files spointainously appear everywhere (wtf...)
This commit is contained in:
		| @@ -12,7 +12,7 @@ ConfigManager::~ConfigManager() { | ||||
| } | ||||
|  | ||||
| void ConfigManager::setPath(std::string file) { | ||||
|     path = file; | ||||
|     path = std::filesystem::absolute(file).string(); | ||||
| } | ||||
|  | ||||
| void ConfigManager::load(json def, bool lock) { | ||||
|   | ||||
| @@ -305,6 +305,8 @@ int sdrpp_main(int argc, char* argv[]) { | ||||
|     json bandColors = core::configManager.conf["bandColors"]; | ||||
|     core::configManager.release(); | ||||
|  | ||||
|     // Assert that the resource directory is absolute and check existance | ||||
|     resDir = std::filesystem::absolute(resDir).string(); | ||||
|     if (!std::filesystem::is_directory(resDir)) { | ||||
|         spdlog::error("Resource directory doesn't exist! Please make sure that you've configured it correctly in config.json (check readme for details)"); | ||||
|         return 1; | ||||
|   | ||||
| @@ -46,6 +46,10 @@ void MainWindow::init() { | ||||
|     std::string resourcesDir = core::configManager.conf["resourcesDirectory"]; | ||||
|     core::configManager.release(); | ||||
|  | ||||
|     // Assert that directories are absolute | ||||
|     modulesDir = std::filesystem::absolute(modulesDir).string(); | ||||
|     resourcesDir = std::filesystem::absolute(resourcesDir).string(); | ||||
|  | ||||
|     // Load menu elements | ||||
|     gui::menu.order.clear(); | ||||
|     for (auto& elem : menuElements) { | ||||
| @@ -123,9 +127,10 @@ void MainWindow::init() { | ||||
|  | ||||
|     // Load additional modules specified through config | ||||
|     for (auto const& path : modules) { | ||||
|         spdlog::info("Loading {0}", path); | ||||
|         LoadingScreen::show("Loading " + path); | ||||
|         core::moduleManager.loadModule(path); | ||||
|         std::string apath = std::filesystem::absolute(path).string(); | ||||
|         spdlog::info("Loading {0}", apath); | ||||
|         LoadingScreen::show("Loading " + apath); | ||||
|         core::moduleManager.loadModule(apath); | ||||
|     } | ||||
|  | ||||
|     // Create module instances | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| #include <options.h> | ||||
| #include <spdlog/spdlog.h> | ||||
| #include <stdlib.h> | ||||
| #include <filesystem> | ||||
|  | ||||
| namespace options { | ||||
|     CMDLineOptions opts; | ||||
| @@ -16,6 +17,7 @@ namespace options { | ||||
|         std::string homedir = getenv("HOME"); | ||||
|         opts.root = homedir + "/.config/sdrpp"; | ||||
| #endif | ||||
|         opts.root = std::filesystem::absolute(opts.root).string(); | ||||
|     } | ||||
|  | ||||
|     bool parse(int argc, char* argv[]) { | ||||
| @@ -23,7 +25,7 @@ namespace options { | ||||
|             char* arg = argv[i]; | ||||
|             if (!strcmp(arg, "-r") || !strcmp(arg, "--root")) { | ||||
|                 if (i == argc - 1) { return false; } | ||||
|                 opts.root = argv[++i]; | ||||
|                 opts.root = std::filesystem::absolute(argv[++i]).string(); | ||||
|             } | ||||
|             else if (!strcmp(arg, "-s") || !strcmp(arg, "--show-console")) { | ||||
|                 opts.showConsole = true; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user