| 45 | } |
| 46 | |
| 47 | void loadDocuments(const FilePath& rootPath, const FileSearchPath& searchPath, const StringSet& skipFiles, |
| 48 | const StringSet& includeFiles, vector<DocumentPtr>& documents, StringVec& documentsPaths, |
| 49 | const XmlReadOptions* readOptions, StringVec* errors) |
| 50 | { |
| 51 | for (const FilePath& dir : rootPath.getSubDirectories()) |
| 52 | { |
| 53 | for (const FilePath& file : dir.getFilesInDirectory(MTLX_EXTENSION)) |
| 54 | { |
| 55 | if (!skipFiles.count(file) && |
| 56 | (includeFiles.empty() || includeFiles.count(file))) |
| 57 | { |
| 58 | DocumentPtr doc = createDocument(); |
| 59 | const FilePath filePath = dir / file; |
| 60 | try |
| 61 | { |
| 62 | FileSearchPath readSearchPath(searchPath); |
| 63 | readSearchPath.append(dir); |
| 64 | readFromXmlFile(doc, filePath, readSearchPath, readOptions); |
| 65 | documents.push_back(doc); |
| 66 | documentsPaths.push_back(filePath.asString()); |
| 67 | } |
| 68 | catch (Exception& e) |
| 69 | { |
| 70 | if (errors) |
| 71 | { |
| 72 | errors->push_back("Failed to load: " + filePath.asString() + ". Error: " + e.what()); |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | void loadLibrary(const FilePath& file, DocumentPtr doc, const FileSearchPath& searchPath, const XmlReadOptions* readOptions) |
| 81 | { |
no test coverage detected