1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-02 08:25:02 -04: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(); File destinationFolder = resolve(s, d).getParentFile();
// destination folder is the source, or is inside the source folder // 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; return;
} }
try { try {
// guess affected folder depth // 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++) { for (int i = 0; i < tailSize && !isStructureRoot(sourceFolder); sourceFolder = sourceFolder.getParentFile(), i++) {
File[] children = sourceFolder.listFiles(); File[] children = sourceFolder.listFiles();