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/11 10:14:13 UTC

[GitHub] [groovy] xaaria opened a new pull request #1554: GROOVY-4990 Make File.write() create any missing directories. Add test.

xaaria opened a new pull request #1554:
URL: https://github.com/apache/groovy/pull/1554


   This MR will:
   - Fix issue where `java.io.FileNotFoundException` is thrown when parent directories don't exists
   - Add test
   
   https://issues.apache.org/jira/browse/GROOVY-4990


-- 
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



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

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #1554:
URL: https://github.com/apache/groovy/pull/1554


   


-- 
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



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

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #1554:
URL: https://github.com/apache/groovy/pull/1554


   


-- 
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



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

Posted by GitBox <gi...@apache.org>.
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



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

Posted by GitBox <gi...@apache.org>.
xaaria commented on pull request #1554:
URL: https://github.com/apache/groovy/pull/1554#issuecomment-826069148


   @paulk-asert We implented this (easy) feature because participating an open source project is a mandatory part of our university's course _Software Engineering Methodologies_. So to be honest I [we] have no further opinion about this.


-- 
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



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

Posted by GitBox <gi...@apache.org>.
paulk-asert commented on pull request #1554:
URL: https://github.com/apache/groovy/pull/1554#issuecomment-826272790


   I merged and tweaked your test and modified the DGM methods as per the earlier suggestion. Thanks.


-- 
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



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

Posted by GitBox <gi...@apache.org>.
paulk-asert commented on pull request #1554:
URL: https://github.com/apache/groovy/pull/1554#issuecomment-826272790


   I merged and tweaked your test and modified the DGM methods as per the earlier suggestion. Thanks.


-- 
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



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

Posted by GitBox <gi...@apache.org>.
xaaria commented on pull request #1554:
URL: https://github.com/apache/groovy/pull/1554#issuecomment-826069148


   @paulk-asert We implented this (easy) feature because participating an open source project is a mandatory part of our university's course _Software Engineering Methodologies_. So to be honest I [we] have no further opinion about this.


-- 
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



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

Posted by GitBox <gi...@apache.org>.
paulk-asert edited a comment 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 = ...
   ```
   @xaaria 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