1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-24 16:58:51 -05:00

// try to merge overlapping path sections

This commit is contained in:
Reinhard Pointner 2016-04-13 18:41:04 +00:00
parent 69311852d1
commit 92b8592652

View File

@ -76,14 +76,14 @@ class ExpressionFormatter implements MatchFormatter {
// try to resolve against structure root folder by default // try to resolve against structure root folder by default
try { try {
File structureRoot = getStructureRoot(source); File structureRoot = getStructureRoot(source);
File destinationRoot = listPath(parent).get(0); if (structureRoot != null) {
while (structureRoot != null) { for (File f : listPath(parent)) {
// try to merge overlapping path sections if (isStructureRoot(f)) {
if (!structureRoot.getName().equals(destinationRoot.getName())) {
return new File(structureRoot, destination).getPath();
}
structureRoot = structureRoot.getParentFile(); structureRoot = structureRoot.getParentFile();
} }
}
return new File(structureRoot, destination).getPath();
}
} catch (Exception e) { } catch (Exception e) {
debug.log(Level.SEVERE, "Failed to resolve structure root: " + source, e); debug.log(Level.SEVERE, "Failed to resolve structure root: " + source, e);
} }