1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 08:18:52 -05:00

Correctly guess affected folder depth

This commit is contained in:
Reinhard Pointner 2016-05-12 20:39:47 +08:00
parent d5bdb33799
commit 9e87393258

View File

@ -160,13 +160,13 @@ class RenameAction extends AbstractAction {
File destinationFolder = resolve(s, d).getParentFile();
// destination folder is the source, or is inside the source folder
if (destinationFolder.getPath().startsWith(sourceFolder.getPath())) {
if (d.getParentFile() == null || destinationFolder.getPath().startsWith(sourceFolder.getPath())) {
return;
}
try {
// guess affected folder depth
int tailSize = listStructurePathTail(s).size();
int tailSize = listStructurePathTail(d.getParentFile()).size();
for (int i = 0; i < tailSize && !isStructureRoot(sourceFolder); sourceFolder = sourceFolder.getParentFile(), i++) {
File[] children = sourceFolder.listFiles();