175 |
} while (FindNextFile(hDir, &win32FindData)); |
} while (FindNextFile(hDir, &win32FindData)); |
176 |
if (hDir != INVALID_HANDLE_VALUE) FindClose(hDir); |
if (hDir != INVALID_HANDLE_VALUE) FindClose(hDir); |
177 |
#else // POSIX |
#else // POSIX |
178 |
|
#if defined(__APPLE__) /* 20071224 Toshi Nagata */ |
179 |
|
String Config_plugin_dir = (String)CONFIG_PLUGIN_DIR; |
180 |
|
if (Config_plugin_dir.find("~") == 0) |
181 |
|
Config_plugin_dir.replace(0, 1, getenv("HOME")); |
182 |
|
DIR* hDir = opendir(Config_plugin_dir.c_str()); |
183 |
|
#else |
184 |
DIR* hDir = opendir(CONFIG_PLUGIN_DIR); |
DIR* hDir = opendir(CONFIG_PLUGIN_DIR); |
185 |
|
#endif |
186 |
if (!hDir) { |
if (!hDir) { |
187 |
std::cerr << "Could not open instrument editor plugins directory " |
std::cerr << "Could not open instrument editor plugins directory " |
188 |
<< "(" << CONFIG_PLUGIN_DIR << "): " |
<< "(" << CONFIG_PLUGIN_DIR << "): " |
191 |
} |
} |
192 |
for (dirent* pEntry = readdir(hDir); pEntry; pEntry = readdir(hDir)) { |
for (dirent* pEntry = readdir(hDir); pEntry; pEntry = readdir(hDir)) { |
193 |
// dir entry name as full qualified path |
// dir entry name as full qualified path |
194 |
|
#if defined(__APPLE__) /* 20080110 Toshi Nagata */ |
195 |
|
const String sPath = Config_plugin_dir + ("/" + String(pEntry->d_name)); |
196 |
|
#else |
197 |
const String sPath = CONFIG_PLUGIN_DIR + ("/" + String(pEntry->d_name)); |
const String sPath = CONFIG_PLUGIN_DIR + ("/" + String(pEntry->d_name)); |
198 |
|
#endif |
199 |
// skip entries that are not regular files |
// skip entries that are not regular files |
200 |
struct stat entry_stat; |
struct stat entry_stat; |
201 |
if (lstat(sPath.c_str(), &entry_stat) != 0 || |
if (lstat(sPath.c_str(), &entry_stat) != 0 || |