RFR: storage: support nested paths in file storage
Erik Helin
ehelin at openjdk.java.net
Tue Sep 1 09:36:20 UTC 2020
On Tue, 1 Sep 2020 09:12:37 GMT, Robin Westberg <rwestberg at openjdk.org> wrote:
>> Hi all,
>>
>> please review this path that makes `FileStorage` with files in nested directories.
>>
>> Testing:
>> - `make test` passes on Linux x64
>> - Manual testing on Linux x64
>>
>> Thanks,
>> Erik
>
> storage/src/main/java/org/openjdk/skara/storage/FileStorage.java line 68:
>
>> 67: Files.createDirectories(file.getParent());
>> 68: if (!Files.exists(file)) {
>> 69: Files.createFile(file);
>
> Doesn't hurt, but Files.writeString should create it if it doesn't exist as well I think.
It didn't for nested paths, so the `Files.createDirectories` is definitely needed. The `if (!Files.exists)` could
potentially be left out, but otoh it doesn't hurt to be explicit here.
-------------
PR: https://git.openjdk.java.net/skara/pull/760
More information about the skara-dev
mailing list