| 32 | } |
| 33 | |
| 34 | std::string GetFilePathByUrl(std::string const & url) |
| 35 | { |
| 36 | auto const urlComponents = strings::Tokenize(url, "/"); |
| 37 | CHECK_GREATER(urlComponents.size(), 3, (urlComponents)); |
| 38 | CHECK_LESS(urlComponents.size(), 6, (urlComponents)); |
| 39 | |
| 40 | uint64_t dataVersion = 0; |
| 41 | CHECK(strings::to_uint(urlComponents[2], dataVersion), ()); |
| 42 | |
| 43 | std::string mwmFile = url::UrlDecode(urlComponents.back()); |
| 44 | // remove extension |
| 45 | mwmFile = mwmFile.substr(0, mwmFile.find('.')); |
| 46 | |
| 47 | auto const fileType = urlComponents[0] == kDiffsPath ? MapFileType::Diff : MapFileType::Map; |
| 48 | return platform::GetFileDownloadPath(dataVersion, mwmFile, fileType); |
| 49 | } |
| 50 | |
| 51 | } // namespace downloader |