You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2021/04/19 07:22:20 UTC

[GitHub] [groovy] paulk-asert commented on pull request #1554: GROOVY-4990 Make File.write() create any missing directories. Add test.

paulk-asert commented on pull request #1554:
URL: https://github.com/apache/groovy/pull/1554#issuecomment-822236024


   Hi, thanks for your PR. While automatically creating the parent directories is in some ways super nice, it might also be surprising for folks familiar with current Java behavior. I think I prefer the `mkParentDirs` suggestion mentioned in the Jira issue, though I'd probably call it `createParentDirectories` these days to match the newer nio styling. Then it could also be used for `setBytes` and so on, not just `write`. What do you think about that suggestion and if you like the idea, would you feel up for altering the PR?
   Suggested methods to add:
   ```
   File ResourceGroovyMethods#createParentDirectories(File self)
   Path NioExtensions#createParentDirectories(Path self, FileAttribute<?>... attrs)
   ```
   Usage:
   ```
   file.createParentDirectories().write(...)
   path.createParentDirectories().bytes = ...
   ```
   What do you think? Or if you want me to progress, just let me know.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org