Hello everybody!

Would you please help review a small change to File.mkdirs() method?

The current implementation of the method, when past an argument "dir1/../dir2" only tries to create dir2.
mkdir -p 'dir1/../dir2' command on Linux creates both dir1 and dir2.
java.nio.file.Files.createDirectories() also creates both dir1 and dir2.

The proposed fix makes File.mkdirs() method to behave in the same way on all the platforms except for Windows.

The problem with Windows is that it reports 'dir1/..' as existent even if dir1 does not exist. Because of that Files.createDirectories() doesn't work this way on Windows either.

Proposed fix:
- makes File.mkdirs() match the behavior of 'mkdir -p' on Linux, Solaris and MacOS, and
- doesn't change its behavior on Windows.

http://cr.openjdk.java.net/~igerasim/6883354/0/webrev/

Sincerely yours,
Ivan Gerasimov

Reply via email to