The existing method Files.delete does not guarantee synchronous behavior, meaning that on some platforms (i.e. Windows) the file may not have been deleted by the time the method returns.
For code that relies on the deletion taking place in a timely manner (i.e before proceeding into code that presumes the non-existence of the file in question) this means such code must make sure to pause until it can be verified that the file no longer exists. This code can be tricky to write and get right. (Notice the subtle difference between Files.exists and Files.notExists)
It would help to have a standard convenience method available that provides synchronous deletion of a file system object.
It would further help if there was a method to delete the contents of a directory before deleting the directory itself.
For code that relies on the deletion taking place in a timely manner (i.e before proceeding into code that presumes the non-existence of the file in question) this means such code must make sure to pause until it can be verified that the file no longer exists. This code can be tricky to write and get right. (Notice the subtle difference between Files.exists and Files.notExists)
It would help to have a standard convenience method available that provides synchronous deletion of a file system object.
It would further help if there was a method to delete the contents of a directory before deleting the directory itself.
- relates to
-
JDK-8208227 tools/jdeps/DotFileTest.java fails on Win-X64
-
- Resolved
-
- links to