comparison 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
comparison
equal deleted inserted replaced
1471:85e9b7b31a8d 1483:7459f4c4d7c3
38 38
39 #ifdef HAVE_LRDF 39 #ifdef HAVE_LRDF
40 #include "lrdf.h" 40 #include "lrdf.h"
41 #endif // HAVE_LRDF 41 #endif // HAVE_LRDF
42 42
43 using std::string;
43 44
44 LADSPAPluginFactory::LADSPAPluginFactory() 45 LADSPAPluginFactory::LADSPAPluginFactory()
45 { 46 {
46 #ifdef HAVE_LRDF 47 #ifdef HAVE_LRDF
47 lrdf_init(); 48 lrdf_init();
564 565
565 std::vector<QString> 566 std::vector<QString>
566 LADSPAPluginFactory::getPluginPath() 567 LADSPAPluginFactory::getPluginPath()
567 { 568 {
568 std::vector<QString> pathList; 569 std::vector<QString> pathList;
569 std::string path; 570 string path;
570 571
571 char *cpath = getenv("LADSPA_PATH"); 572 (void)getEnvUtf8("DSSI_PATH", path);
572 if (cpath) path = cpath;
573 573
574 if (path == "") { 574 if (path == "") {
575 575
576 path = DEFAULT_LADSPA_PATH; 576 path = DEFAULT_LADSPA_PATH;
577 577
578 char *home = getenv("HOME"); 578 string home;
579 if (home) { 579 if (getEnvUtf8("HOME", home)) {
580 std::string::size_type f; 580 string::size_type f;
581 while ((f = path.find("$HOME")) != std::string::npos && 581 while ((f = path.find("$HOME")) != string::npos &&
582 f < path.length()) { 582 f < path.length()) {
583 path.replace(f, 5, home); 583 path.replace(f, 5, home);
584 } 584 }
585 } 585 }
586 586
587 #ifdef _WIN32 587 #ifdef _WIN32
588 const char *pfiles = getenv("ProgramFiles"); 588 string pfiles;
589 if (!pfiles) pfiles = "C:\\Program Files"; 589 if (!getEnvUtf8("ProgramFiles", pfiles)) {
590 { 590 pfiles = "C:\\Program Files";
591 std::string::size_type f; 591 }
592 while ((f = path.find("%ProgramFiles%")) != std::string::npos && 592
593 string::size_type f;
594 while ((f = path.find("%ProgramFiles%")) != string::npos &&
593 f < path.length()) { 595 f < path.length()) {
594 path.replace(f, 14, pfiles); 596 path.replace(f, 14, pfiles);
595 } 597 }
596 } 598 #endif
597 #endif 599 }
598 } 600
599 601 string::size_type index = 0, newindex = 0;
600 std::string::size_type index = 0, newindex = 0;
601 602
602 while ((newindex = path.find(PATH_SEPARATOR, index)) < path.size()) { 603 while ((newindex = path.find(PATH_SEPARATOR, index)) < path.size()) {
603 pathList.push_back(path.substr(index, newindex - index).c_str()); 604 pathList.push_back(path.substr(index, newindex - index).c_str());
604 index = newindex + 1; 605 index = newindex + 1;
605 } 606 }
732 } 733 }
733 734
734 QString category = m_taxonomy[identifier]; 735 QString category = m_taxonomy[identifier];
735 736
736 if (category == "") { 737 if (category == "") {
737 std::string name = rtd->name; 738 string name = rtd->name;
738 if (name.length() > 4 && 739 if (name.length() > 4 &&
739 name.substr(name.length() - 4) == " VST") { 740 name.substr(name.length() - 4) == " VST") {
740 category = "VST effects"; 741 category = "VST effects";
741 m_taxonomy[identifier] = category; 742 m_taxonomy[identifier] = category;
742 } 743 }