2 Copyright (C) 2008 John Emmas
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "ardour/vst_search_path.h"
25 #ifdef PLATFORM_WINDOWS
28 #include <shlobj.h> // CSIDL_*
29 #include "pbd/windows_special_dirs.h"
36 DWORD dwType = REG_SZ;
38 DWORD dwSize = PATH_MAX;
43 if (ERROR_SUCCESS == RegOpenKeyExA (HKEY_CURRENT_USER, "Software\\VST", 0, KEY_READ, &hKey)) {
44 // Look for the user's VST Registry entry
45 if (ERROR_SUCCESS == RegQueryValueExA (hKey, "VSTPluginsPath", 0, &dwType, (LPBYTE)tmp, &dwSize))
46 p = g_build_filename (Glib::locale_to_utf8(tmp).c_str(), 0);
52 if (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\VST", 0, KEY_READ, &hKey))
54 // Look for a global VST Registry entry
55 if (ERROR_SUCCESS == RegQueryValueExA (hKey, "VSTPluginsPath", 0, &dwType, (LPBYTE)tmp, &dwSize))
56 p = g_build_filename (Glib::locale_to_utf8(tmp).c_str(), 0);
64 char *pProgFilesX86 = PBD::get_win_special_folder (CSIDL_PROGRAM_FILESX86);
67 // Look for a VST folder under C:\Program Files (x86)
68 if (pVSTx86 = g_build_filename (pProgFilesX86, "Steinberg", "VSTPlugins", 0))
70 if (Glib::file_test (pVSTx86, Glib::FILE_TEST_EXISTS))
71 if (Glib::file_test (pVSTx86, Glib::FILE_TEST_IS_DIR))
72 p = g_build_filename (pVSTx86, 0);
77 g_free (pProgFilesX86);
81 // Look for a VST folder under C:\Program Files
83 char *pProgFiles = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES);
86 if (pVST = g_build_filename (pProgFiles, "Steinberg", "VSTPlugins", 0)) {
87 if (Glib::file_test (pVST, Glib::FILE_TEST_EXISTS))
88 if (Glib::file_test (pVST, Glib::FILE_TEST_IS_DIR))
89 p = g_build_filename (pVST, 0);
100 // If all else failed, assume the plugins are under "My Documents"
101 user_home = (char*) g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
103 p = g_build_filename (user_home, "Plugins", "VST", 0);
105 user_home = g_build_filename(g_get_home_dir(), "My Documents", 0);
107 p = g_build_filename (user_home, "Plugins", "VST", 0);
110 // Concatenate the registry path with the user's personal path
111 user_home = (char*) g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
114 p = g_build_path (";", p, g_build_filename(user_home, "Plugins", "VST", 0), 0);
116 user_home = g_build_filename(g_get_home_dir(), "My Documents", 0);
119 p = g_build_path (";", p, g_build_filename (user_home, "Plugins", "VST", 0), 0);
127 } // namespace ARDOUR
131 /* Unix-like. Probably require some OS X specific breakdown if we ever add VST
132 * support on that platform.
140 return "/usr/local/lib/vst:/usr/lib/vst";
143 } // namespace ARDOUR
145 #endif /* PLATFORM_WINDOWS */