From 55e485c4bc27c3e45ecd451bb11b8099833fd277 Mon Sep 17 00:00:00 2001 From: Grische <10663446-grische@users.noreply.gitlab.com> Date: Sat, 19 Feb 2022 12:12:10 +0000 Subject: [PATCH] automatically create shared-zip directory --- src/com/sheepit/client/standalone/Worker.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/com/sheepit/client/standalone/Worker.java b/src/com/sheepit/client/standalone/Worker.java index ac08095..d28ccb7 100644 --- a/src/com/sheepit/client/standalone/Worker.java +++ b/src/com/sheepit/client/standalone/Worker.java @@ -141,8 +141,16 @@ public class Worker { if (sharedDownloadsDir != null) { File dir = new File(sharedDownloadsDir); - if (dir.exists() == false || dir.canWrite() == false) { - System.err.println("ERROR: The shared-zip directory must exist and be writeable"); + if (dir.exists() == false && dir.mkdirs()) { + Log.getInstance(config).debug("created shared-zip directory " + dir); + } + else if (dir.exists() == false) { + System.err.println("ERROR: The shared-zip directory " + dir + " does not exist and cannot be automatically created"); + return; + } + + if (dir.canWrite() == false) { + System.err.println("ERROR: The shared-zip directory " + dir + " must be writeable"); return; } config.setSharedDownloadsDirectory(dir);