| 94 | // func takes a const fs::directory_entry parameter and returns false to stop iteration |
| 95 | template<typename Func> |
| 96 | static void iterateObjectFolder(fs::path path, bool shouldRecurse, Func&& func) |
| 97 | { |
| 98 | if (!fs::exists(path)) |
| 99 | { |
| 100 | return; |
| 101 | } |
| 102 | auto f = [&func](const fs::directory_entry& file) { |
| 103 | if (!file.is_regular_file()) |
| 104 | { |
| 105 | return true; |
| 106 | } |
| 107 | const auto extension = file.path().extension().u8string(); |
| 108 | if (!Utility::iequals(extension, ".DAT")) |
| 109 | { |
| 110 | return true; |
| 111 | } |
| 112 | return func(file); |
| 113 | }; |
| 114 | |
| 115 | if (shouldRecurse) |
| 116 | { |
| 117 | for (const auto& file : fs::recursive_directory_iterator(path, fs::directory_options::skip_permission_denied)) |
| 118 | { |
| 119 | if (!f(file)) |
| 120 | { |
| 121 | break; |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | else |
| 126 | { |
| 127 | for (const auto& file : fs::directory_iterator(path, fs::directory_options::skip_permission_denied)) |
| 128 | { |
| 129 | if (!f(file)) |
| 130 | { |
| 131 | break; |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | // 0x00470F3C |
| 138 | static ObjectFolderState getCurrentObjectFolderState(fs::path path, bool shouldRecurse) |
no test coverage detected