status_t AddOnManager::GetReaders(entry_ref* outRefs, int32* outCount, int32 maxCount) { BAutolock locker(fLock); RegisterAddOns(); *outCount = 0; // See GetDecoderForFormat() for why we need to scan the list by path. char** directories = NULL; size_t directoryCount = 0; if (find_paths_etc(get_architecture(), B_FIND_PATH_ADD_ONS_DIRECTORY, "media/plugins", B_FIND_PATH_EXISTING_ONLY, &directories, &directoryCount) != B_OK) { printf("AddOnManager::GetReaders: failed to locate plugins\n"); return B_ENTRY_NOT_FOUND; } MemoryDeleter directoriesDeleter(directories); BPath path; for (uint i = 0; i < directoryCount; i++) { path.SetTo(directories[i]); _GetReaders(path, outRefs, outCount, maxCount); } return B_OK; }
status_t AddOnManager::GetReaders(xfer_entry_ref* outRefs, int32* outCount, int32 maxCount) { BAutolock locker(fLock); *outCount = 0; // See GetDecoderForFormat() for why we need to scan the list by path. BPath path; for (uint i = 0; i < sizeof(sDirectories) / sizeof(directory_which); i++) { if (find_directory(sDirectories[i], &path) != B_OK || path.Append("media/plugins") != B_OK) { printf("AddOnManager::GetReaders: failed to construct " "path for directory %u\n", i); continue; } _GetReaders(path, outRefs, outCount, maxCount); } return B_OK; }