diff options
author | Alex Zolotarev <deathbaba@gmail.com> | 2012-01-06 23:13:29 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:31:23 +0300 |
commit | 3932615f2a7e4539b06b8426028067ca92974776 (patch) | |
tree | 9da613dd8811122b84b14ba0f7195b30ca558053 /platform/platform.hpp | |
parent | 99a00dda73a793ef506fcf16ef80f3dab20282ff (diff) |
Added Platform::TmpPathForFile() and Platform::SettingsPathForFile()
Closed #492 - Save viewport on Android when external memory is ejected
Diffstat (limited to 'platform/platform.hpp')
-rw-r--r-- | platform/platform.hpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/platform/platform.hpp b/platform/platform.hpp index a4c92a4dca..e73832d640 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -16,14 +16,24 @@ DECLARE_EXCEPTION(NotImplementedException, RootException); class Platform { protected: - string m_writableDir, m_resourcesDir; + /// Usually read-only directory for application resources + string m_resourcesDir; + /// Writable directory to store downloaded map data + /// @note on some systems it can point to external ejectable storage + string m_writableDir; + /// Temporary directory, can be cleaned up by the system + string m_tmpDir; + /// Writable directory to store persistent application data + string m_settingsDir; + class PlatformImpl; /// Used only on those platforms where needed PlatformImpl * m_impl; static bool IsFileExistsByFullPath(string const & filePath); - /// Internal function to use files from writable dir if they override the same in the resources + /// Internal function to use files from writable dir + /// if they override the same file in the resources dir string ReadPathForFile(string const & file) const { string fullPath = m_writableDir + file; @@ -48,6 +58,17 @@ public: /// @return resource dir (on some platforms it's differ from Writable dir) string ResourcesDir() const { return m_resourcesDir; } + /// @return path for directory with temporary files with slash at the end + string TmpDir() const { return m_tmpDir; } + /// @return full path to file in the temporary directory + string TmpPathForFile(string const & file) const { return TmpDir() + file; } + + /// @return path for directory in the persistent memory, can be the same + /// as WritableDir, but on some platforms it's different + string SettingsDir() const { return m_settingsDir; } + /// @return full path to file in the settings directory + string SettingsPathForFile(string const & file) const { return SettingsDir() + file; } + /// @return reader for file decriptor. /// @throws FileAbsentException /// @param[in] file descriptor which we want to read |