From f11866738a7443635a0b8ab6a39470d370a352ff Mon Sep 17 00:00:00 2001 From: Dmitry Yunitsky Date: Mon, 10 Nov 2014 12:52:35 +0300 Subject: [PATCH] One more workaround of SD card problem. --- .../maps/settings/StoragePathManager.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/android/src/com/mapswithme/maps/settings/StoragePathManager.java b/android/src/com/mapswithme/maps/settings/StoragePathManager.java index 15241875d7..30eb868c11 100644 --- a/android/src/com/mapswithme/maps/settings/StoragePathManager.java +++ b/android/src/com/mapswithme/maps/settings/StoragePathManager.java @@ -197,21 +197,20 @@ public class StoragePathManager } else { - File file = new File(testStorage + Constants.PACKAGE_STORAGES_PATH); - if (file.exists()) // if storage doesn't contain "./Android/data/" directory - it is not SD card, ignore it + testStorage += suffix; + File file = new File(testStorage); + if (!file.exists()) // create directory for our package if it isn't created by any reason { - testStorage += suffix; + Log.i(TAG, "Try to create MWM path"); + file.mkdirs(); file = new File(testStorage); - if (!file.exists()) // create directory for our package if it isn't created by any reason - { - Log.i(TAG, "Found sd card without directory for MWM package : " + testStorage); - file.mkdirs(); - } - if (isDirWritable(testStorage)) - { - Log.i(TAG, "Found writable storage : " + testStorage); - paths.add(testStorage); - } + if (file.exists()) + Log.i(TAG, "Created!"); + } + if (isDirWritable(testStorage)) + { + Log.i(TAG, "Found writable storage : " + testStorage); + paths.add(testStorage); } } }