I ran into a situation where com.globalmentor.io.Files.deleteFileTree(Path) failed when the Path did not exist. Irrespective of the behavior of File.delete(), the deleteFileTree() method should not return any sort of error if the tree has already been deleted. Whether there is a check up-front, any missing-path exception should be caught and ignored to handle the race condition. Unit (integration?) tests need to be added.
At some point Files.delete(File file, boolean recursive) was marked as deprecated in favor of deleteFileTree(@Nonnull final Path fileTreeRoot) . The former may have been deprecated because (according to the API documentation) it follows symbolic links. Maybe both should be present for completeness. In any case, for the latter, there is a java.nio.file.deleteIfExists(Path path), so perhaps naming this java.nio.file.deleteIfExists(Path path, boolean recursive) would be more appropriate.
I ran into a situation where
com.globalmentor.io.Files.deleteFileTree(Path)
failed when thePath
did not exist. Irrespective of the behavior ofFile.delete()
, thedeleteFileTree()
method should not return any sort of error if the tree has already been deleted. Whether there is a check up-front, any missing-path exception should be caught and ignored to handle the race condition. Unit (integration?) tests need to be added.