Fix bug in Move pp
This commit is contained in:
parent
13783140e9
commit
9806badf57
|
@ -29,6 +29,7 @@ public class Move extends AbstractPlaceholderAwarePostProcessor {
|
|||
String pathTemplate = getConfig().getOrDefault(PATH_TEMPLATE, DEFAULT);
|
||||
String path = fillInPlaceHolders(pathTemplate, rec, config);
|
||||
File src = rec.getPostProcessedFile();
|
||||
boolean isFile = src.isFile();
|
||||
File target = new File(path, src.getName());
|
||||
if (Objects.equals(src, target)) {
|
||||
return;
|
||||
|
@ -42,7 +43,7 @@ public class Move extends AbstractPlaceholderAwarePostProcessor {
|
|||
}
|
||||
rec.getAssociatedFiles().remove(src.getCanonicalPath());
|
||||
rec.getAssociatedFiles().add(target.getCanonicalPath());
|
||||
if (src.isFile()) {
|
||||
if (isFile) {
|
||||
deleteEmptyParents(src.getParentFile());
|
||||
} else {
|
||||
deleteEmptyParents(src);
|
||||
|
|
|
@ -25,6 +25,7 @@ public class MoveSingleFileTest extends AbstractPpTest {
|
|||
rec.setAbsoluteFile(original);
|
||||
rec.setStartDate(now);
|
||||
rec.setSingleFile(true);
|
||||
|
||||
Move pp = new Move();
|
||||
pp.getConfig().put(Move.PATH_TEMPLATE, new File(baseDir.toFile(), Move.DEFAULT).getAbsolutePath());
|
||||
pp.postprocess(rec, recordingManager, config);
|
||||
|
|
Loading…
Reference in New Issue