diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-02-06 21:26:48 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-02-06 21:26:48 +0100 |
commit | c8c3a38db08d2fb158beea7b09052dc248275463 (patch) | |
tree | ad6be62f61527cb938136a56228a0c363d600be9 | |
parent | dbb38cccf968ac4c97b643613497457b32cf29df (diff) |
check if media folders are existing, if not, create them
fixes #101
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index 4ad3d9e39..da7ed84dc 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -183,11 +183,18 @@ public class FileBackend { } public static String getConversationsDirectory(final String type) { - if (type == "null" || type == null) { - return Environment.getExternalStorageDirectory().getAbsolutePath() + getDirectoryName(null); - } else { - return Environment.getExternalStorageDirectory().getAbsolutePath() + getDirectoryName(type); + String DirName = null; + if (type != "null" || type != null) { + DirName = type; } + String path = Environment.getExternalStorageDirectory().getAbsolutePath() + getDirectoryName(DirName); + File createFolders = new File(path); + if (!createFolders.exists()) { + Log.d(Config.LOGTAG, "creating directory " + createFolders); + createFolders.mkdirs(); + } + return path; + } public Bitmap resize(Bitmap originalBitmap, int size) { |