From f3f1ac939a81f8695fc1a88dbf0b049e10bdb32f Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 26 Feb 2022 16:25:15 +0100 Subject: [PATCH] fix: Executable directory not getting added to paths correctly on Linux --- lib/libimhex/source/helpers/paths.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/libimhex/source/helpers/paths.cpp b/lib/libimhex/source/helpers/paths.cpp index 4de17fbd0..db2f5a36c 100644 --- a/lib/libimhex/source/helpers/paths.cpp +++ b/lib/libimhex/source/helpers/paths.cpp @@ -173,12 +173,15 @@ namespace hex { std::vector configDirs = xdg::ConfigDirs(); std::vector dataDirs = xdg::DataDirs(); - configDirs.insert(configDirs.begin(), xdg::ConfigHomeDir()); - dataDirs.insert(dataDirs.begin(), xdg::DataHomeDir()); + configDirs.push_back(xdg::ConfigHomeDir()); + dataDirs.push_back(xdg::DataHomeDir()); for (auto &dir : dataDirs) dir = dir / "imhex"; + if (!exePath.empty()) + dataDirs.emplace(dataDirs.begin(), fs::path(exePath.data()).parent_path()); + switch (path) { case ImHexPath::Patterns: addUserDirs(dataDirs); @@ -224,8 +227,6 @@ namespace hex { __builtin_unreachable(); } - if (!exePath.empty()) - dataDirs.emplace(dataDirs.begin(), fs::path(exePath.data()).parent_path()); #endif if (!listNonExisting) {