From c342383ede4c8a612415a30433e07293a48c5df7 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Wed, 26 Dec 2012 12:51:48 +0100 Subject: [PATCH] Fixed bug in getDataFolder didn't behave correctly if 'type' contained path separators --- src/de/danoeh/antennapod/PodcastApp.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/de/danoeh/antennapod/PodcastApp.java b/src/de/danoeh/antennapod/PodcastApp.java index f7962c50f..58dbf2a23 100644 --- a/src/de/danoeh/antennapod/PodcastApp.java +++ b/src/de/danoeh/antennapod/PodcastApp.java @@ -241,6 +241,19 @@ public class PodcastApp extends Application implements if (type == null) { return dataDir; } else { + // handle path separators + String[] dirs = type.split("/"); + for (int i = 0; i < dirs.length; i++) { + if (dirs.length > 0) { + if (i < dirs.length - 1) { + dataDir = getDataFolder(context, dirs[i]); + if (dataDir == null) { + return null; + } + } + type = dirs[i]; + } + } File typeDir = new File(dataDir, type); if (!typeDir.exists()) { if (dataDir.canWrite()) { @@ -265,5 +278,6 @@ public class PodcastApp extends Application implements SharedPreferences.Editor editor = prefs.edit(); editor.putString(PodcastApp.PREF_DATA_FOLDER, dir); editor.commit(); + createImportDirectory(); } }