Fixed download of non-mwm(eg .ttf) assets from servers.

This commit is contained in:
Dmitry Yunitsky 2015-07-07 18:54:27 +03:00 committed by Alex Zolotarev
parent 05016a6188
commit a64351d1e6
3 changed files with 10 additions and 7 deletions

View file

@ -213,11 +213,7 @@ extern "C"
storage::Storage const & storage = g_framework->Storage();
for (size_t i = 0; i < curFile.m_urls.size(); ++i)
{
string baseName = curFile.m_fileName;
my::GetNameWithoutExt(baseName);
storage::TIndex const index = storage.FindIndexByFile(baseName);
curFile.m_urls[i] = storage.GetFileDownloadUrl(curFile.m_urls[i], index, TMapOptions::EMap);
curFile.m_urls[i] = storage.GetFileDownloadUrl(curFile.m_urls[i], curFile.m_fileName);
LOG(LDEBUG, (curFile.m_urls[i]));
}

View file

@ -599,8 +599,12 @@ string Storage::GetFileDownloadUrl(string const & baseUrl, TIndex const & index,
TMapOptions file) const
{
CountryFile const & countryFile = GetCountryFile(index);
return baseUrl + OMIM_OS_NAME "/" + strings::to_string(GetCurrentDataVersion()) + "/" +
UrlEncode(countryFile.GetNameWithExt(file));
return GetFileDownloadUrl(baseUrl, countryFile.GetNameWithExt(file));
}
string Storage::GetFileDownloadUrl(string const & baseUrl, string const & fName) const
{
return baseUrl + OMIM_OS_NAME "/" + strings::to_string(GetCurrentDataVersion()) + "/" + UrlEncode(fName);
}
TIndex Storage::FindIndexByFile(string const & name) const

View file

@ -162,7 +162,10 @@ public:
void NotifyStatusChanged(TIndex const & index);
/// get download url by index & options(first search file name by index, then format url)
string GetFileDownloadUrl(string const & baseUrl, TIndex const & index, TMapOptions file) const;
/// get download url by base url & file name
string GetFileDownloadUrl(string const & baseUrl, string const & fName) const;
/// @param[out] res Populated with oudated countries.
void GetOutdatedCountries(vector<Country const *> & countries) const;