From 0fade2c41bfd568bf7361f0ca54c600209742434 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 8 Jan 2024 11:26:18 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=83=9E?= =?UTF-8?q?=E3=83=8D=E3=83=BC=E3=82=B8=E3=83=A3=E3=81=AB=E3=83=A1=E3=82=BD?= =?UTF-8?q?=E3=83=83=E3=83=89=E8=BF=BD=E5=8A=A0,=20=E5=BE=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/file/impl/FileManagerImpl.java | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) 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 7912db6e..16e32ee1 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 @@ -82,13 +82,12 @@ public class FileManagerImpl implements FileManager { //ディレクトリ作成 logger.debug("createDir", "called"); - Path dir = currentDir.resolve(dirName); - if (!Files.exists(dir)) { - try { - Files.createDirectories(dir); - } catch (IOException e) { - e.printStackTrace(); - } + Path path = currentDir.resolve(dirName); + logger.debug("createDir", "path: " + path); + try { + Files.createDirectory(path); + } catch (IOException e) { + e.printStackTrace(); } } @@ -110,6 +109,24 @@ public class FileManagerImpl implements FileManager { currentDir.resolve(fileName).toFile().delete(); // TODO-rca: エラーハンドリング } + @Override + public boolean isExist(Path path) { + logger.debug("isExist", "called"); + return Files.exists(path); + } + + @Override + public void autoCreateDir(Path path) { + logger.debug("autoCreateDir", "called"); + if (!Files.exists(path)) { + try { + Files.createDirectories(path); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + @Override public void saveBitmapAtCurrent(Bitmap bitmap, String fileName) { // TODO-rca: ファイル形式を変更できるようにする?