Fixed bug in getDataFolder

didn't behave correctly if 'type' contained path separators
This commit is contained in:
daniel oeh 2012-12-26 12:51:48 +01:00
parent 0e5ffeb9ca
commit c342383ede
1 changed files with 14 additions and 0 deletions

View File

@ -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();
}
}