| 20 | namespace embedx { |
| 21 | |
| 22 | bool Loader::Load(const std::string& path, int thread_num) { |
| 23 | vec_str_t files; |
| 24 | if (!io_util::ListFile(path, &files)) { |
| 25 | return false; |
| 26 | } |
| 27 | |
| 28 | thread_num = std::min(thread_num, (int)files.size()); |
| 29 | if (!io_util::ParallelProcess<std::string>( |
| 30 | files, |
| 31 | [this](const vec_str_t& files, int thread_id) { |
| 32 | return LoadEntry(files, thread_id); |
| 33 | }, |
| 34 | thread_num)) { |
| 35 | DXERROR("Failed to load files."); |
| 36 | return false; |
| 37 | } |
| 38 | |
| 39 | return true; |
| 40 | } |
| 41 | |
| 42 | } // namespace embedx |