| 146 | } |
| 147 | } // namespace |
| 148 | |
| 149 | bool LooksLikeMod(const std::string& dir) |
| 150 | { |
| 151 | namespace fs = std::filesystem; |
| 152 | std::error_code ec; |
| 153 | for (fs::directory_iterator it(dir, ec), end; it != end; it.increment(ec)) |
| 154 | { |
| 155 | if (ec) |
| 156 | break; |
| 157 | const std::string name = LowerAscii(it->path().filename().string()); |
| 158 | std::error_code mec; |
| 159 | // addons/dta/campaigns + a bin/ config override are what a mod changes. |
| 160 | // Missions/MPMissions are deliberately excluded — mission packs are a |
| 161 | // separate content type, not mods. |
| 162 | if (it->is_directory(mec) && (name == "addons" || name == "dta" || name == "bin" || name == "campaigns")) |
| 163 | return true; |
| 164 | if (it->is_regular_file(mec) && name == "mod.json") |
| 165 | return true; |
| 166 | } |
| 167 | return false; |
| 168 | } |
| 169 | |
| 170 | std::vector<Mod> ScanModsRoot(const std::string& root, ModSource source) |
no test coverage detected