diff plugin/LADSPAPluginFactory.cpp @ 1483:7459f4c4d7c3

Merge from branch plugin-path-config
author Chris Cannam
date Mon, 11 Jun 2018 14:40:09 +0100
parents 5ac102155409
children 900601b954f2
line wrap: on
line diff
--- a/plugin/LADSPAPluginFactory.cpp	Thu May 24 16:30:55 2018 +0100
+++ b/plugin/LADSPAPluginFactory.cpp	Mon Jun 11 14:40:09 2018 +0100
@@ -40,6 +40,7 @@
 #include "lrdf.h"
 #endif // HAVE_LRDF
 
+using std::string;
 
 LADSPAPluginFactory::LADSPAPluginFactory()
 {
@@ -566,38 +567,38 @@
 LADSPAPluginFactory::getPluginPath()
 {
     std::vector<QString> pathList;
-    std::string path;
+    string path;
 
-    char *cpath = getenv("LADSPA_PATH");
-    if (cpath) path = cpath;
+    (void)getEnvUtf8("DSSI_PATH", path);
 
     if (path == "") {
 
         path = DEFAULT_LADSPA_PATH;
 
-        char *home = getenv("HOME");
-        if (home) {
-            std::string::size_type f;
-            while ((f = path.find("$HOME")) != std::string::npos &&
+        string home;
+        if (getEnvUtf8("HOME", home)) {
+            string::size_type f;
+            while ((f = path.find("$HOME")) != string::npos &&
                    f < path.length()) {
                 path.replace(f, 5, home);
             }
         }
 
 #ifdef _WIN32
-        const char *pfiles = getenv("ProgramFiles");
-        if (!pfiles) pfiles = "C:\\Program Files";
-        {
-        std::string::size_type f;
-        while ((f = path.find("%ProgramFiles%")) != std::string::npos &&
+        string pfiles;
+        if (!getEnvUtf8("ProgramFiles", pfiles)) {
+            pfiles = "C:\\Program Files";
+        }
+
+        string::size_type f;
+        while ((f = path.find("%ProgramFiles%")) != string::npos &&
                f < path.length()) {
             path.replace(f, 14, pfiles);
         }
-        }
 #endif
     }
 
-    std::string::size_type index = 0, newindex = 0;
+    string::size_type index = 0, newindex = 0;
 
     while ((newindex = path.find(PATH_SEPARATOR, index)) < path.size()) {
         pathList.push_back(path.substr(index, newindex - index).c_str());
@@ -734,7 +735,7 @@
         QString category = m_taxonomy[identifier];
         
         if (category == "") {
-            std::string name = rtd->name;
+            string name = rtd->name;
             if (name.length() > 4 &&
                 name.substr(name.length() - 4) == " VST") {
                 category = "VST effects";