diff options
author | vng <viktor.govako@gmail.com> | 2012-11-16 21:11:39 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:47:00 +0300 |
commit | 7fca6a746e5e38b3c684b822984b4ee1b246c4d1 (patch) | |
tree | 029baeab823811e825cfde618f5df78ff0547ba5 /android/jni/com/mapswithme/platform/Platform.cpp | |
parent | 106b0b58168d456e25510e4aa6fb01eeecb36631 (diff) |
[android] Fix bug with correct storage path for downloading.
Diffstat (limited to 'android/jni/com/mapswithme/platform/Platform.cpp')
-rw-r--r-- | android/jni/com/mapswithme/platform/Platform.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/android/jni/com/mapswithme/platform/Platform.cpp b/android/jni/com/mapswithme/platform/Platform.cpp index a2f885be43..9e3abbcf6a 100644 --- a/android/jni/com/mapswithme/platform/Platform.cpp +++ b/android/jni/com/mapswithme/platform/Platform.cpp @@ -92,8 +92,7 @@ namespace android // It stores path to current maps storage. m_settingsDir = jni::ToNativeString(env, storagePath); - if (!Settings::Get("StoragePath", m_writableDir) || - (GetWritableStorageStatus(1024) != ::Platform::STORAGE_OK)) + if (!Settings::Get("StoragePath", m_writableDir) || !HasAvailableSpaceForWriting(1024)) { // If no saved storage path or the storage is unavailable // (disconnected from the last session), assign writable @@ -123,7 +122,7 @@ namespace android m_tmpDir = m_localTmpPath; } - string Platform::GetStoragePathPrefix() + string Platform::GetStoragePathPrefix() const { size_t const count = m_writableDir.size(); ASSERT_GREATER ( count, 2, () ); @@ -140,6 +139,11 @@ namespace android Settings::Set("StoragePath", m_writableDir); } + bool Platform::HasAvailableSpaceForWriting(uint64_t size) const + { + return (GetWritableStorageStatus(size) == ::Platform::STORAGE_OK); + } + Platform & Platform::Instance() { static Platform platform; |