From 42f46aeac5e9d73b664f3dd8e8476f1d3c8a2827 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 10 Jul 2023 13:10:30 +0200 Subject: [PATCH] config: minor path handling fixes --- src/config/ConfigManager.cpp | 1 + src/helpers/MiscFunctions.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 7bdd3ae7..85b30d58 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1516,6 +1516,7 @@ void CConfigManager::loadConfigLoadVars() { while (std::getline(ifs, line)) { // Read line by line. try { + configCurrentPath = mainConfigPath; parseLine(line); } catch (...) { Debug::log(ERR, "Error reading line from config. Line:"); diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index 1010a29e..d18c8f47 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -130,9 +130,9 @@ std::string absolutePath(const std::string& rawpath, const std::string& currentP if (value[1] == '.') { auto parentDir = currentDir.substr(0, currentDir.find_last_of('/')); - value.replace(0, 2, parentDir); + value.replace(0, 2 + currentPath.empty(), parentDir); } else { - value.replace(0, 1, currentDir); + value.replace(0, 1 + currentPath.empty(), currentDir); } }