From 26584198afaee65e5c70779b534a7cab811f1b52 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Tue, 12 Sep 2023 12:53:52 +0900 Subject: [PATCH] no message --- .../java/cokr/xit/fims/cmmn/DirectoryStructureToJson.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/cokr/xit/fims/cmmn/DirectoryStructureToJson.java b/src/main/java/cokr/xit/fims/cmmn/DirectoryStructureToJson.java index 63273d46..d932e0b5 100644 --- a/src/main/java/cokr/xit/fims/cmmn/DirectoryStructureToJson.java +++ b/src/main/java/cokr/xit/fims/cmmn/DirectoryStructureToJson.java @@ -1,13 +1,14 @@ package cokr.xit.fims.cmmn; import java.io.File; +import java.io.IOException; import java.util.ArrayList; import java.util.List; public class DirectoryStructureToJson { - public static Node getNode(File fileNode){ - if(fileNode.isDirectory()){ + public static Node getNode(File fileNode) throws IOException{ + if(fileNode.getCanonicalFile().isDirectory()){ return new Node(fileNode.getName(),fileNode.getAbsolutePath(),"directory", getDirList(fileNode)); }else{ return new Node(fileNode.getName(),fileNode.getAbsolutePath(),"file",null); @@ -15,7 +16,7 @@ public class DirectoryStructureToJson { } - public static List getDirList(File node){ + public static List getDirList(File node) throws IOException{ List children=new ArrayList<>(); for(File n : node.listFiles()){ children.add(getNode(n));