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));