Fix subfolders for files import

This commit is contained in:
Vitaliy 2020-10-16 01:16:42 +03:00
parent fe83d70d66
commit a7af2a3cf0

View file

@ -115,7 +115,14 @@ public class FileSettingsItem extends StreamSettingsItem {
} else if (subtype == FileSubtype.UNKNOWN || subtype == null) {
throw new IllegalArgumentException("Unknown file subtype: " + getFileName());
} else {
this.file = new File(app.getAppPath(subtype.subtypeFolder), name);
String subtypeFolder = subtype.subtypeFolder;
int nameIndex = fileName.indexOf(name);
int folderIndex = fileName.indexOf(subtype.subtypeFolder);
if (nameIndex != -1 && folderIndex != -1) {
String subfolderPath = fileName.substring(folderIndex + subtype.subtypeFolder.length(), nameIndex);
subtypeFolder = subtypeFolder + subfolderPath;
}
this.file = new File(app.getAppPath(subtypeFolder), name);
}
}