diff --git a/source/src/main/java/one/nem/lacerta/source/file/FileManager.java b/source/src/main/java/one/nem/lacerta/source/file/FileManager.java index 9cc9e503..d69d9972 100644 --- a/source/src/main/java/one/nem/lacerta/source/file/FileManager.java +++ b/source/src/main/java/one/nem/lacerta/source/file/FileManager.java @@ -16,7 +16,9 @@ public interface FileManager { void backRootDir(); //cd / List getList(); void createDir(String dirName); + void createDir(Path path); void removeDir(String dirName); + void removeDir(Path path); File createFile(String fileName); void removeFile(String fileName); @@ -25,6 +27,7 @@ public interface FileManager { boolean isExist(String fileName); void autoCreateDir(Path path); + void autoCreateDir(String dirName); void autoCreateToCurrentDir(); diff --git a/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java b/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java index 4abdc172..73a126ec 100644 --- a/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java +++ b/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java @@ -102,12 +102,29 @@ public class FileManagerImpl implements FileManager { } } + @Override + public void createDir(Path path) { + logger.debug("createDir", "called"); + try { + Files.createDirectory(path); + } catch (IOException e) { + e.printStackTrace(); + } + } + @Override public void removeDir(String dirName) { logger.debug("removeDir", "called"); currentDir.resolve(dirName).toFile().delete(); // TODO-rca: エラーハンドリング } + @Override + public void removeDir(Path path) { + logger.debug("removeDir", "called"); + path.toFile().delete(); // TODO-rca: エラーハンドリング + } + + @Override public File createFile(String fileName) { logger.debug("createFile", "called"); @@ -144,6 +161,18 @@ public class FileManagerImpl implements FileManager { } } + @Override + public void autoCreateDir(String dirName) { + logger.debug("autoCreateDir", "called"); + if (!Files.exists(currentDir.resolve(dirName))) { + try { + Files.createDirectories(currentDir.resolve(dirName)); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + @Override public void autoCreateToCurrentDir() { logger.debug("autoGenerateToCurrentDir", "called");