mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-11-10 12:47:40 +01:00
Fixed weird bug where config files spointainously appear everywhere (wtf...)
This commit is contained in:
parent
66269659c5
commit
470e748e4a
@ -12,7 +12,7 @@ ConfigManager::~ConfigManager() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ConfigManager::setPath(std::string file) {
|
void ConfigManager::setPath(std::string file) {
|
||||||
path = file;
|
path = std::filesystem::absolute(file).string();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigManager::load(json def, bool lock) {
|
void ConfigManager::load(json def, bool lock) {
|
||||||
|
@ -305,6 +305,8 @@ int sdrpp_main(int argc, char* argv[]) {
|
|||||||
json bandColors = core::configManager.conf["bandColors"];
|
json bandColors = core::configManager.conf["bandColors"];
|
||||||
core::configManager.release();
|
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)) {
|
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)");
|
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;
|
return 1;
|
||||||
|
@ -46,6 +46,10 @@ void MainWindow::init() {
|
|||||||
std::string resourcesDir = core::configManager.conf["resourcesDirectory"];
|
std::string resourcesDir = core::configManager.conf["resourcesDirectory"];
|
||||||
core::configManager.release();
|
core::configManager.release();
|
||||||
|
|
||||||
|
// Assert that directories are absolute
|
||||||
|
modulesDir = std::filesystem::absolute(modulesDir).string();
|
||||||
|
resourcesDir = std::filesystem::absolute(resourcesDir).string();
|
||||||
|
|
||||||
// Load menu elements
|
// Load menu elements
|
||||||
gui::menu.order.clear();
|
gui::menu.order.clear();
|
||||||
for (auto& elem : menuElements) {
|
for (auto& elem : menuElements) {
|
||||||
@ -123,9 +127,10 @@ void MainWindow::init() {
|
|||||||
|
|
||||||
// Load additional modules specified through config
|
// Load additional modules specified through config
|
||||||
for (auto const& path : modules) {
|
for (auto const& path : modules) {
|
||||||
spdlog::info("Loading {0}", path);
|
std::string apath = std::filesystem::absolute(path).string();
|
||||||
LoadingScreen::show("Loading " + path);
|
spdlog::info("Loading {0}", apath);
|
||||||
core::moduleManager.loadModule(path);
|
LoadingScreen::show("Loading " + apath);
|
||||||
|
core::moduleManager.loadModule(apath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create module instances
|
// Create module instances
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <options.h>
|
#include <options.h>
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
namespace options {
|
namespace options {
|
||||||
CMDLineOptions opts;
|
CMDLineOptions opts;
|
||||||
@ -16,6 +17,7 @@ namespace options {
|
|||||||
std::string homedir = getenv("HOME");
|
std::string homedir = getenv("HOME");
|
||||||
opts.root = homedir + "/.config/sdrpp";
|
opts.root = homedir + "/.config/sdrpp";
|
||||||
#endif
|
#endif
|
||||||
|
opts.root = std::filesystem::absolute(opts.root).string();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool parse(int argc, char* argv[]) {
|
bool parse(int argc, char* argv[]) {
|
||||||
@ -23,7 +25,7 @@ namespace options {
|
|||||||
char* arg = argv[i];
|
char* arg = argv[i];
|
||||||
if (!strcmp(arg, "-r") || !strcmp(arg, "--root")) {
|
if (!strcmp(arg, "-r") || !strcmp(arg, "--root")) {
|
||||||
if (i == argc - 1) { return false; }
|
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")) {
|
else if (!strcmp(arg, "-s") || !strcmp(arg, "--show-console")) {
|
||||||
opts.showConsole = true;
|
opts.showConsole = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user