You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2021/04/25 07:28:52 UTC

[groovy] branch master updated: missing change from previous commit

This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new ea55bcc  missing change from previous commit
ea55bcc is described below

commit ea55bccd162049c6b28ea037eb190757094ce89e
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sun Apr 25 17:28:31 2021 +1000

    missing change from previous commit
---
 .../org/codehaus/groovy/runtime/ResourceGroovyMethods.java  |  1 +
 .../org/apache/groovy/nio/extensions/NioExtensions.java     | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java b/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
index 418d81a..da95a7d 100644
--- a/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
@@ -62,6 +62,7 @@ import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.nio.charset.Charset;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
diff --git a/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/extensions/NioExtensions.java b/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/extensions/NioExtensions.java
index 1786fda..28d29d2 100644
--- a/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/extensions/NioExtensions.java
+++ b/subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/extensions/NioExtensions.java
@@ -60,6 +60,7 @@ import java.nio.file.DirectoryStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.nio.file.attribute.FileAttribute;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -1885,6 +1886,18 @@ public class NioExtensions extends DefaultGroovyMethodsSupport {
     }
 
     /**
+     * Creates, if needed, any parent directories for the file associated with this Path.
+     *
+     * @param self a Path
+     * @return itself
+     * @throws IOException if the parent directories couldn't be created
+     */
+    public static Path createParentDirectories(Path self, FileAttribute<?>... attrs) throws IOException {
+        Files.createDirectories(self.getParent(), attrs);
+        return self;
+    }
+
+    /**
      * Filters the lines of a Path and creates a Writable in return to
      * stream the filtered lines.
      *