From 826bbf59900cd857d2383bd8459bdd5bd17e16b1 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Wed, 13 Mar 2024 19:53:27 +0100 Subject: [PATCH] Create the directory if not exists --- .../java/ovh/herisson/Clyde/Services/StorageService.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/StorageService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/StorageService.java index c73dd0b..8059c4e 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/StorageService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/StorageService.java @@ -24,6 +24,14 @@ public class StorageService { public StorageService(FileRepository filerepo){ this.fileRepo = filerepo; + + if(!Files.exists(rootLocation)){ + try { + Files.createDirectories(rootLocation); + } catch(IOException e){ + e.printStackTrace(); + } + } }