Commit 3bb21c54 by Maarten L. Hekkelman

Try one more location to locate resources

parent 6d1be23a
...@@ -877,6 +877,21 @@ class resource_pool ...@@ -877,6 +877,21 @@ class resource_pool
resource_pool::resource_pool() resource_pool::resource_pool()
{ {
// directories are searched in reverse order
// As a last resort, try the location that might have been
// used during installation, works only when running on an
// OS with a proc file system.
std::error_code ec;
if (auto exefile = fs::read_symlink("/proc/self/exe", ec); not ec and exefile.parent_path().filename() == "bin")
{
auto install_prefix = exefile.parent_path().parent_path();
auto data_dir = install_prefix / "share" / "libcifpp";
if (fs::exists(data_dir, ec))
pushDir(data_dir);
}
#if defined(DATA_DIR) #if defined(DATA_DIR)
pushDir(DATA_DIR); pushDir(DATA_DIR);
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment