From a302f3f2c39ec9ab703ba0d33d5761ea3f363176 Mon Sep 17 00:00:00 2001 From: Sweidan Omar Date: Fri, 21 Jan 2022 01:24:25 +0000 Subject: [PATCH] #311 git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C32824 --- .../remotestore/LocalDirectoryLister.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/server/user.jobengine.osgi.commons/src/user/commons/remotestore/LocalDirectoryLister.java b/server/user.jobengine.osgi.commons/src/user/commons/remotestore/LocalDirectoryLister.java index 07a66049..d5ae4a1d 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/remotestore/LocalDirectoryLister.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/remotestore/LocalDirectoryLister.java @@ -78,7 +78,7 @@ public class LocalDirectoryLister implements IDirectoryLister { @Override public boolean exists(String fileName) throws Exception { Path path = Paths.get(storeUri.toString(true), fileName); - return path.toFile().exists(); + return Files.exists(path); } @Override @@ -187,4 +187,21 @@ public class LocalDirectoryLister implements IDirectoryLister { return result; } + + private RemoteFile toRemoteFile(Path path) { + RemoteFile result = new RemoteFile(); + + try { + result.setName(path.getFileName().toString()); + result.setModify(Timestamp.from(Files.getLastModifiedTime(path).toInstant())); + result.setIsFolder(Files.isDirectory(path)); + result.setSize(Files.size(path)); + BasicFileAttributes attr = Files.readAttributes(path, BasicFileAttributes.class); + result.setCreated(new Timestamp(attr.creationTime().toMillis())); + } catch (IOException e) { + e.printStackTrace(); + } + + return result; + } } -- 2.54.0