aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-02-06 21:26:48 +0100
committerChristian Schneppe <christian@pix-art.de>2017-02-06 21:26:48 +0100
commitc8c3a38db08d2fb158beea7b09052dc248275463 (patch)
treead6be62f61527cb938136a56228a0c363d600be9
parentdbb38cccf968ac4c97b643613497457b32cf29df (diff)
check if media folders are existing, if not, create them
fixes #101
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java15
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) {