Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / interpreters / supercollider / supercollider-3.12.0-env-dirs.patch
blobdd92028b5225647e3b7dd95f86f7cb6077ffec79
1 diff --git a/common/SC_Filesystem_unix.cpp b/common/SC_Filesystem_unix.cpp
2 index 52dc1fd2d..aae09ed9c 100644
3 --- a/common/SC_Filesystem_unix.cpp
4 +++ b/common/SC_Filesystem_unix.cpp
5 @@ -94,6 +94,10 @@ bool SC_Filesystem::isNonHostPlatformDirectoryName(const std::string& s) {
8 Path SC_Filesystem::defaultSystemAppSupportDirectory() {
9 + const char* sc_data_dir = getenv("SC_DATA_DIR");
10 + if (sc_data_dir)
11 + return Path(sc_data_dir);
13 # ifdef SC_DATA_DIR
14 return Path(SC_DATA_DIR);
15 # else
16 @@ -125,6 +129,10 @@ Path SC_Filesystem::defaultUserConfigDirectory() {
19 Path SC_Filesystem::defaultResourceDirectory() {
20 + const char* sc_data_dir = getenv("SC_DATA_DIR");
21 + if (sc_data_dir)
22 + return Path(sc_data_dir);
24 # ifdef SC_DATA_DIR
25 return Path(SC_DATA_DIR);
26 # else
27 diff --git a/server/scsynth/SC_Lib_Cintf.cpp b/server/scsynth/SC_Lib_Cintf.cpp
28 index f6219307e..28e13eb98 100644
29 --- a/server/scsynth/SC_Lib_Cintf.cpp
30 +++ b/server/scsynth/SC_Lib_Cintf.cpp
31 @@ -178,9 +178,13 @@ void initialize_library(const char* uGensPluginPath) {
32 using DirName = SC_Filesystem::DirName;
34 if (loadUGensExtDirs) {
35 + const char* sc_plugin_dir = getenv("SC_PLUGIN_DIR");
36 + if (sc_plugin_dir) {
37 + PlugIn_LoadDir(sc_plugin_dir, true);
38 + }
39 #ifdef SC_PLUGIN_DIR
40 // load globally installed plugins
41 - if (bfs::is_directory(SC_PLUGIN_DIR)) {
42 + else if (bfs::is_directory(SC_PLUGIN_DIR)) {
43 PlugIn_LoadDir(SC_PLUGIN_DIR, true);
45 #endif // SC_PLUGIN_DIR
46 diff --git a/server/supernova/server/main.cpp b/server/supernova/server/main.cpp
47 index b2b5adf4e..6cb8c411c 100644
48 --- a/server/supernova/server/main.cpp
49 +++ b/server/supernova/server/main.cpp
50 @@ -224,8 +224,14 @@ void set_plugin_paths(server_arguments const& args, nova::sc_ugen_factory* facto
53 } else {
54 + const char* sc_plugin_dir = getenv("SC_PLUGIN_DIR");
55 + if (sc_plugin_dir) {
56 + factory->load_plugin_folder(sc_plugin_dir);
57 + }
58 #ifdef SC_PLUGIN_DIR
59 - factory->load_plugin_folder(SC_PLUGIN_DIR);
60 + else {
61 + factory->load_plugin_folder(SC_PLUGIN_DIR);
62 + }
63 #endif
64 factory->load_plugin_folder(SC_Filesystem::instance().getDirectory(DirName::Resource) / SC_PLUGIN_DIR_NAME);
65 factory->load_plugin_folder(SC_Filesystem::instance().getDirectory(DirName::SystemExtension));