You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2021/11/22 13:53:04 UTC

[GitHub] [sling-org-apache-sling-installer-provider-file] stefanseifert commented on a change in pull request #4: SLING-7504 optionally create directories to monitor

stefanseifert commented on a change in pull request #4:
URL: https://github.com/apache/sling-org-apache-sling-installer-provider-file/pull/4#discussion_r754298684



##########
File path: src/main/java/org/apache/sling/installer/provider/file/impl/FileInstaller.java
##########
@@ -84,6 +88,13 @@ public void start(final OsgiInstaller installer, final SlingSettingsService sett
                 key = "${sling.home}" + key.substring(settings.getSlingHomePath().length());
             }
             logger.debug("Starting monitor for {}", config.directory);
+            if (autoCreateDirectories) {
+                try {
+                    Files.createDirectory(Paths.get(config.directory));

Review comment:
       shouldn't we use here createDirectories instead of createDirectory? not tested it, but just looking at the [documentation](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#createDirectories-java.nio.file.Path-java.nio.file.attribute.FileAttribute...-) it seems that the latter may create an exception if the directory already exists, whereas the former should not. furthermore it might be helpful to also create missing parent directories.




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

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

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