From 91ebd05063c2d8a55021ced40643ba9f2fe54e14 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 12 Dec 2019 14:21:35 +0100 Subject: [PATCH] Add `initFileList()` in `ServerManagement.java` --- src/server/ServerManagement.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/server/ServerManagement.java b/src/server/ServerManagement.java index dd09361..641fe25 100644 --- a/src/server/ServerManagement.java +++ b/src/server/ServerManagement.java @@ -13,6 +13,18 @@ public class ServerManagement { initFileList(); } + private void initFileList() { + File folder = new File(baseDirectory); + File[] files = folder.listFiles(); + /* Add non-recursively files's names to fileList */ + for (int i = 0; i < files.length; i++) { + if (files[i].isFile()) { + fileList.add(files[i].getName()); + } + } + + } + public void upload(String filename) throws NotFound { }