Search the installation data directory (#693)
That allows the logic to work on non-FHS distros like NixOS
This commit is contained in:
parent
af8e756dcb
commit
e0d26ba25a
@ -97,6 +97,11 @@ option(ALSOFT_UPDATE_BUILD_VERSION "Update git build version info" ON)
|
||||
|
||||
option(ALSOFT_EAX "Enable legacy EAX extensions" ${WIN32})
|
||||
|
||||
option(ALSOFT_SEARCH_INSTALL_DATADIR "Search the installation data directory" OFF)
|
||||
if(ALSOFT_SEARCH_INSTALL_DATADIR)
|
||||
set(ALSOFT_INSTALL_DATADIR ${CMAKE_INSTALL_FULL_DATADIR})
|
||||
endif()
|
||||
|
||||
if(DEFINED SHARE_INSTALL_DIR)
|
||||
message(WARNING "SHARE_INSTALL_DIR is deprecated. Use the variables provided by the GNUInstallDirs module instead")
|
||||
set(CMAKE_INSTALL_DATADIR "${SHARE_INSTALL_DIR}")
|
||||
|
@ -114,3 +114,6 @@
|
||||
|
||||
/* Define if we have pthread_set_name_np() */
|
||||
#cmakedefine HAVE_PTHREAD_SET_NAME_NP
|
||||
|
||||
/* Define the installation data directory */
|
||||
#cmakedefine ALSOFT_INSTALL_DATADIR "@ALSOFT_INSTALL_DATADIR@"
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user