| 267 | } |
| 268 | |
| 269 | void PluginManager::getPluginList(char* SubFolderName, bool append) |
| 270 | { |
| 271 | //printf("%s\n", __FUNCTION__); |
| 272 | |
| 273 | // Check for prior setting, if set clear for new one |
| 274 | if (m_pluginlistset) |
| 275 | { |
| 276 | if (!append) |
| 277 | clearPluginList(); |
| 278 | else |
| 279 | return; |
| 280 | } |
| 281 | else |
| 282 | m_pluginlistset = true; |
| 283 | |
| 284 | #ifdef _WIN32 |
| 285 | WIN32_FIND_DATAA fd; |
| 286 | char fname[MAX_PATH]; |
| 287 | |
| 288 | //---------------------------------- |
| 289 | // Load plugin List for processing |
| 290 | // Use an Enviornment var, search through systems path |
| 291 | // or use default app running folder. |
| 292 | //---------------------------------- |
| 293 | char dirPath[MAX_PATH]; |
| 294 | |
| 295 | // v2.1 change - to check if path exists in PATH or AMDCOMPRESS_PLUGINS is set |
| 296 | // else use current exe directory |
| 297 | char* pPath; |
| 298 | size_t len; |
| 299 | |
| 300 | #ifdef _WIN32 |
| 301 | _dupenv_s(&pPath, &len, "AMDCOMPRESS_PLUGINS"); |
| 302 | #else |
| 303 | pPath = getenv("AMDCOMPRESS_PLUGINS") + '\0'; |
| 304 | len = strlen(pPath); |
| 305 | #endif |
| 306 | |
| 307 | if (len > 0) |
| 308 | { |
| 309 | snprintf(dirPath, 260, "%s", pPath + '\0'); |
| 310 | } |
| 311 | else |
| 312 | { |
| 313 | bool pathFound = false; |
| 314 | |
| 315 | //Get the exe directory |
| 316 | DWORD pathsize; |
| 317 | HMODULE hModule = GetModuleHandleA(NULL); |
| 318 | pathsize = GetModuleFileNameA(hModule, dirPath, MAX_PATH); |
| 319 | if (pathsize > 0) |
| 320 | { |
| 321 | char* appName = (strrchr(dirPath, '\\') + 1); |
| 322 | int pathLen = (int)strlen(dirPath); |
| 323 | int appNameLen = (int)strlen(appName); |
| 324 | |
| 325 | // Null terminate the dirPath so that FileName is removed |
| 326 | pathLen = pathLen - appNameLen; |
no test coverage detected