No Path equivalent to File.mkdirs() ?

Rémi Forax forax at univ-mlv.fr
Tue Apr 28 05:32:00 PDT 2009


Alan Bateman a écrit :
> Rémi Forax wrote:
>> Is there an equivalent to File.mkdirs() with NIO.2 ?
>>
>> I was not able to find it.
>>
>> cheers,
>> Rémi
> No, it's not there. All the primitives required to implement it as a 
> utility method are there of course (mkdirs, as you probably know, is 
> one of those troublesome composite operations that may fail with part 
> of the directory tree created).
Yes, but don't provide it as a utility method will have the following 
effects:
- users will not using Path API
- users will create a File from a Path to call mkdirs()
- users will create their own code
So I think it's a good idea to create this helper method in Paths.

By the way, there is also no way to get a File from a Path
for the default FileSystem.
So the compatibility between File and Path is only
in one way. This will  delay the adoption of the Path API.

>
> -Alan.
Rémi



More information about the nio-dev mailing list