From c1da2497a79adf09561b631b74258ff910f6b158 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 4 Aug 2022 08:56:58 +0200 Subject: [PATCH] fs: Fix paths on macOS --- lib/libimhex/source/helpers/fs.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/libimhex/source/helpers/fs.cpp b/lib/libimhex/source/helpers/fs.cpp index ab6b4df1c..6921b9bd0 100644 --- a/lib/libimhex/source/helpers/fs.cpp +++ b/lib/libimhex/source/helpers/fs.cpp @@ -137,12 +137,24 @@ namespace hex::fs { #endif + for (auto &path : paths) { path = path / "imhex"; } - if (auto executablePath = fs::getExecutablePath(); executablePath.has_value()) - paths.push_back(executablePath->parent_path()); + + #if defined(OS_MACOS) + + if (auto executablePath = fs::getExecutablePath(); executablePath.has_value()) + paths.push_back(*executablePath); + + #else + + if (auto executablePath = fs::getExecutablePath(); executablePath.has_value()) + paths.push_back(executablePath->parent_path()); + + #endif + auto additionalDirs = ImHexApi::System::getAdditionalFolderPaths(); std::copy(additionalDirs.begin(), additionalDirs.end(), std::back_inserter(paths));