Skip to content
Snippets Groups Projects
Commit 684be05f authored by dgelessus's avatar dgelessus
Browse files

Move generated dat files instead of copying and then deleting

parent 68ad0a18
No related branches found
No related tags found
No related merge requests found
...@@ -127,16 +127,19 @@ public abstract class SableCCTask extends SourceTask { ...@@ -127,16 +127,19 @@ public abstract class SableCCTask extends SourceTask {
}); });
// Move generated dat files from Java source directory to resources directory. // Move generated dat files from Java source directory to resources directory.
this.getFs().copy(spec -> { ConfigurableFileTree datFiles = this.objectFactory.fileTree();
spec.from(destinationJavaPath); datFiles.from(destinationJavaPath);
spec.into(destinationResourcesPath); datFiles.include("**/*.dat");
spec.include("**/*.dat"); for (File datFile : datFiles) {
}); Path sourcePath = datFile.toPath();
this.getFs().delete(spec -> { assert sourcePath.isAbsolute();
ConfigurableFileTree fileTree = this.objectFactory.fileTree(); Path relativePath = destinationJavaPath.relativize(sourcePath);
fileTree.from(destinationJavaPath); Path destinationPath = destinationResourcesPath.resolve(relativePath);
fileTree.include("**/*.dat"); assert destinationPath.isAbsolute();
spec.delete(fileTree); if (destinationPath.getParent() != null) {
}); Files.createDirectories(destinationPath.getParent());
}
Files.move(sourcePath, destinationPath);
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment