mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-12-01 12:31:45 +00:00
Fixed bug in getDataFolder
didn't behave correctly if 'type' contained path separators
This commit is contained in:
@ -241,6 +241,19 @@ public class PodcastApp extends Application implements
|
|||||||
if (type == null) {
|
if (type == null) {
|
||||||
return dataDir;
|
return dataDir;
|
||||||
} else {
|
} 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);
|
File typeDir = new File(dataDir, type);
|
||||||
if (!typeDir.exists()) {
|
if (!typeDir.exists()) {
|
||||||
if (dataDir.canWrite()) {
|
if (dataDir.canWrite()) {
|
||||||
@ -265,5 +278,6 @@ public class PodcastApp extends Application implements
|
|||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
editor.putString(PodcastApp.PREF_DATA_FOLDER, dir);
|
editor.putString(PodcastApp.PREF_DATA_FOLDER, dir);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
|
createImportDirectory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user