From 08c3800baeedb817bb96c7ffa79c3dbf6f8b09b7 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(); + } + } }