diff options
author | Lev Dragunov <l.dragunov@corp.mail.ru> | 2015-03-06 19:19:04 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:38:25 +0300 |
commit | cbc137f24089dac4f4540e23747bb7b0259c936b (patch) | |
tree | 6ba7f4be58d6aed030973755b77af39cbed0c7ba /platform | |
parent | fa062c45a4f4c76ca313e9da41efe18948cea326 (diff) |
Extract index path generation from offsets table class
Diffstat (limited to 'platform')
-rw-r--r-- | platform/platform.cpp | 9 | ||||
-rw-r--r-- | platform/platform.hpp | 4 | ||||
-rw-r--r-- | platform/platform_android.cpp | 3 |
3 files changed, 12 insertions, 4 deletions
diff --git a/platform/platform.cpp b/platform/platform.cpp index ab89c3d7c1..87504f8108 100644 --- a/platform/platform.cpp +++ b/platform/platform.cpp @@ -95,10 +95,15 @@ string Platform::DeviceName() const return OMIM_OS_NAME; } -string Platform::WritablePathForCountryIndexes(string const & fileName) const +string Platform::WritablePathForCountryIndexes(string const & mwmName) const { - string dir = WritableDir() + fileName + my::GetNativeSeparator(); + string dir = WritableDir() + mwmName + my::GetNativeSeparator(); if (!IsFileExistsByFullPath(dir)) MkDir(dir); return dir; } + +string Platform::GetIndexFileName(string const & mwmName, string const & extension) const +{ + return GetPlatform().WritablePathForCountryIndexes(mwmName) + mwmName + extension; +} diff --git a/platform/platform.hpp b/platform/platform.hpp index f90f32a01e..82208d1402 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -61,7 +61,9 @@ public: /// @return full path to file in user's writable directory string WritablePathForFile(string const & file) const { return WritableDir() + file; } /// @return full path to indexes directory for country file. Creates directory if it's not exists. - string WritablePathForCountryIndexes(string const & country_name) const; + string WritablePathForCountryIndexes(string const & mwmName) const; + /// @return generate full path to index based on mwmName and index extension + string GetIndexFileName(string const & mwmName, string const & extension) const; /// @return resource dir (on some platforms it's differ from Writable dir) string ResourcesDir() const { return m_resourcesDir; } diff --git a/platform/platform_android.cpp b/platform/platform_android.cpp index aa330bc70a..6e83a93c5b 100644 --- a/platform/platform_android.cpp +++ b/platform/platform_android.cpp @@ -246,7 +246,8 @@ bool Platform::GetFileSizeByName(string const & fileName, uint64_t & size) const void Platform::MkDir(string const & dirName) const { - ::mkdir(dirName.c_str(), 0755); + if (mkdir(dirName.c_str(), 0755)) + LOG(LWARNING, ("Can't create directory: ", dirName)); } namespace |