From dc6c7bd0ceb9b322b94f4a9545fb2f55d0e7cfaa Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 21 Apr 2019 08:16:35 +0200 Subject: [PATCH] Add a lookup for resources in ../share/solvespace. This is useful for relocatable bundles, e.g. AppImage or NixOS. --- src/platform/platform.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/platform/platform.cpp b/src/platform/platform.cpp index eb5779c..3620ba1 100644 --- a/src/platform/platform.cpp +++ b/src/platform/platform.cpp @@ -541,6 +541,12 @@ static Platform::Path FindLocalResourceDir() { return resourceDir; } + resourceDir = selfPath.Parent().Parent().Join("share/solvespace"); + if(stat(resourceDir.raw.c_str(), &st) != -1) { + // A resource directory exists at a relative path, good. + return resourceDir; + } + // No executable-adjacent resource directory; use the one from compile-time prefix. return Path::From(UNIX_DATADIR); }