@@ -112,6 +112,35 @@ public void create(@NotNull final URL url) throws IOException, URISyntaxExceptio
112112 * @throws IOException on error
113113 */
114114 public void copyDirectory (Path src , Path dest ) throws IOException {
115+ try (Stream <Path > stream = Files .walk (src )) {
116+ stream .forEach (sourceFile -> {
117+ if (sourceFile .equals (src )) {
118+ return ;
119+ }
120+ try {
121+ Path destRelativePath = getDestinationRelativePath (src , sourceFile );
122+ Path destPath = dest .resolve (destRelativePath );
123+ if (Files .isDirectory (sourceFile )) {
124+ if (!Files .exists (destPath )) {
125+ Files .createDirectory (destPath );
126+ }
127+ return ;
128+ }
129+ Files .copy (sourceFile , destPath , REPLACE_EXISTING , COPY_ATTRIBUTES );
130+ } catch (Exception e ) {
131+ throw new RuntimeException (e );
132+ }
133+ });
134+ }
135+ }
136+
137+ /**
138+ * Assumes the destination directory exists.
139+ * @param src source directory
140+ * @param dest destination directory
141+ * @throws IOException on error
142+ */
143+ public void copyDirectoryWithUniqueModifiedTime (Path src , Path dest ) throws IOException {
115144 // Create a deterministic order of paths for creation time, so last modified time indexing is stable in tests
116145 // note we cannot use Files.copy(sourceFile, destPath, REPLACE_EXISTING, COPY_ATTRIBUTES)
117146 // as the original creation time is the user checkout and not different accross files
0 commit comments