| 1264 | } |
| 1265 | |
| 1266 | void Storage::DeleteCountryFiles(CountryId const & countryId, MapFileType type, bool deferredDelete) |
| 1267 | { |
| 1268 | auto const it = m_localFiles.find(countryId); |
| 1269 | if (it == m_localFiles.end()) |
| 1270 | return; |
| 1271 | |
| 1272 | if (deferredDelete) |
| 1273 | { |
| 1274 | m_localFiles.erase(countryId); |
| 1275 | return; |
| 1276 | } |
| 1277 | |
| 1278 | auto & localFiles = it->second; |
| 1279 | for (auto & localFile : localFiles) |
| 1280 | { |
| 1281 | DeleteFromDiskWithIndexes(*localFile, type); |
| 1282 | localFile->SyncWithDisk(); |
| 1283 | if (!localFile->HasFiles()) |
| 1284 | localFile.reset(); |
| 1285 | } |
| 1286 | auto isNull = [](LocalFilePtr const & localFile) { return !localFile; }; |
| 1287 | localFiles.remove_if(isNull); |
| 1288 | if (localFiles.empty()) |
| 1289 | m_localFiles.erase(countryId); |
| 1290 | } |
| 1291 | |
| 1292 | bool Storage::DeleteCountryFilesFromDownloader(CountryId const & countryId) |
| 1293 | { |
nothing calls this directly
no test coverage detected