MCPcopy Create free account
hub / github.com/comaps/comaps / GetFilePathByUrl

Function GetFilePathByUrl

libs/platform/downloader_utils.cpp:34–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34std::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

Callers 1

UNIT_TESTFunction · 0.85

Calls 7

to_uintFunction · 0.85
UrlDecodeFunction · 0.85
backMethod · 0.80
GetFileDownloadPathFunction · 0.70
TokenizeFunction · 0.50
sizeMethod · 0.45
findMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.68