From e0d26ba25ab84f5a04a6ad2ef497cd0e93684a40 Mon Sep 17 00:00:00 2001
From: ilya-fedin <fedin-ilja2010@ya.ru>
Date: Sat, 14 May 2022 00:55:17 +0400
Subject: Search the installation data directory (#693)

That allows the logic to work on non-FHS distros like NixOS
---
 core/helpers.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'core/helpers.cpp')

diff --git a/core/helpers.cpp b/core/helpers.cpp
index c7e45a8b..6d0863ca 100644
--- a/core/helpers.cpp
+++ b/core/helpers.cpp
@@ -408,6 +408,20 @@ al::vector<std::string> SearchDataFiles(const char *ext, const char *subdir)
         DirectorySearch(path.c_str(), ext, &results);
     }
 
+#ifdef ALSOFT_INSTALL_DATADIR
+    // Search the installation data directory
+    {
+        std::string path{ALSOFT_INSTALL_DATADIR};
+        if(!path.empty())
+        {
+            if(path.back() != '/')
+                path += '/';
+            path += subdir;
+            DirectorySearch(path.c_str(), ext, &results);
+        }
+    }
+#endif
+
     return results;
 }
 
-- 
cgit v1.2.3