| 142 | } |
| 143 | |
| 144 | PluginPaths VSTEffectsModule::FindModulePaths(PluginManagerInterface & pm) |
| 145 | { |
| 146 | FilePaths pathList; |
| 147 | FilePaths files; |
| 148 | |
| 149 | // Check for the VST_PATH environment variable |
| 150 | wxString vstpath = wxString::FromUTF8(getenv("VST_PATH")); |
| 151 | if (!vstpath.empty()) |
| 152 | { |
| 153 | wxStringTokenizer tok(vstpath, wxPATH_SEP); |
| 154 | while (tok.HasMoreTokens()) |
| 155 | { |
| 156 | pathList.push_back(tok.GetNextToken()); |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | const auto AddCustomPaths = [](PluginManagerInterface& pm, VSTEffectsModule& module, FilePaths& pathList) |
| 161 | { |
| 162 | const auto customPaths = pm.ReadCustomPaths(module); |
| 163 | std::copy(customPaths.begin(), customPaths.end(), std::back_inserter(pathList)); |
| 164 | }; |
| 165 | |
| 166 | #if defined(__WXMAC__) |
| 167 | #define VSTPATH wxT("/Library/Audio/Plug-Ins/VST") |
| 168 | |
| 169 | // Look in ~/Library/Audio/Plug-Ins/VST and /Library/Audio/Plug-Ins/VST |
| 170 | pathList.push_back(wxGetHomeDir() + wxFILE_SEP_PATH + VSTPATH); |
| 171 | pathList.push_back(VSTPATH); |
| 172 | |
| 173 | AddCustomPaths(pm, *this, pathList); |
| 174 | |
| 175 | // Recursively search all paths for Info.plist files. This will identify all |
| 176 | // bundles. |
| 177 | pm.FindFilesInPathList(wxT("Info.plist"), pathList, files, true); |
| 178 | |
| 179 | // Remove the 'Contents/Info.plist' portion of the names |
| 180 | for (size_t i = 0; i < files.size(); i++) |
| 181 | { |
| 182 | files[i] = wxPathOnly(wxPathOnly(files[i])); |
| 183 | if (!files[i].EndsWith(wxT(".vst"))) |
| 184 | { |
| 185 | files.erase( files.begin() + i-- ); |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | #elif defined(__WXMSW__) |
| 190 | |
| 191 | TCHAR dpath[MAX_PATH]; |
| 192 | TCHAR tpath[MAX_PATH]; |
| 193 | DWORD len; |
| 194 | |
| 195 | // Try HKEY_CURRENT_USER registry key first |
| 196 | len = WXSIZEOF(tpath); |
| 197 | if (SHRegGetUSValue(wxT("Software\\VST"), |
| 198 | wxT("VSTPluginsPath"), |
| 199 | NULL, |
| 200 | tpath, |
| 201 | &len, |
nothing calls this directly
no test coverage detected