Add a lookup for resources in ../share/solvespace.

This is useful for relocatable bundles, e.g. AppImage or NixOS.
pull/403/head
probonopd 2019-04-21 08:16:35 +02:00 committed by whitequark
parent 945a28277f
commit dc6c7bd0ce
1 changed files with 6 additions and 0 deletions

View File

@ -541,6 +541,12 @@ static Platform::Path FindLocalResourceDir() {
return resourceDir; 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. // No executable-adjacent resource directory; use the one from compile-time prefix.
return Path::From(UNIX_DATADIR); return Path::From(UNIX_DATADIR);
} }