diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-12-26 12:51:48 +0100 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-12-26 12:51:48 +0100 |
commit | c342383ede4c8a612415a30433e07293a48c5df7 (patch) | |
tree | 703e847ea687cdd2f4f358d187f115c35dfdc947 | |
parent | 0e5ffeb9ca871069b5492b0e49bc88fb5c7e4721 (diff) | |
download | AntennaPod-c342383ede4c8a612415a30433e07293a48c5df7.zip |
Fixed bug in getDataFolder
didn't behave correctly if 'type' contained path separators
-rw-r--r-- | src/de/danoeh/antennapod/PodcastApp.java | 14 |
1 files changed, 14 insertions, 0 deletions
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(); } } |