From 67350639c753413029f3ca5617f41ca125b49ed1 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 8 Jan 2024 11:12:51 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E4=BD=9C?= =?UTF-8?q?=E6=88=90/=E5=89=8A=E9=99=A4=E3=82=92=E8=BF=BD=E5=8A=A0=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/source/file/FileManager.java | 4 ++++ .../source/file/impl/FileManagerImpl.java | 20 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) 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 258c0a0d..30a89143 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 @@ -2,6 +2,7 @@ package one.nem.lacerta.source.file; import android.graphics.Bitmap; +import java.io.File; import java.nio.file.Path; import java.util.List; @@ -16,6 +17,9 @@ public interface FileManager { void createDir(String dirName); void removeDir(String dirName); + File createFile(String fileName); + void removeFile(String fileName); + void saveBitmapAtCurrent(Bitmap bitmap, String fileName); Bitmap loadBitmap(Path path); void removeBitmap(Path path); 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 c986f72a..ea105a24 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 @@ -14,6 +14,8 @@ import dagger.assisted.Assisted; import dagger.assisted.AssistedInject; import one.nem.lacerta.source.file.FileManager; +import one.nem.lacerta.utils.LacertaLogger; + public class FileManagerImpl implements FileManager { // RootDir @@ -32,8 +34,12 @@ public class FileManagerImpl implements FileManager { } } + // Injection + private LacertaLogger logger; + @AssistedInject - public FileManagerImpl(@Assisted Path rootDir) { + public FileManagerImpl(LacertaLogger logger, @Assisted Path rootDir) { + this.logger = logger; this.rootDir = rootDir; this.currentDir = rootDir; } @@ -73,6 +79,7 @@ public class FileManagerImpl implements FileManager { @Override public void createDir(String dirName) { + //ディレクトリ作成 currentDir.resolve(dirName).toFile().mkdir(); // TODO-rca: エラーハンドリング } @@ -81,6 +88,17 @@ public class FileManagerImpl implements FileManager { currentDir.resolve(dirName).toFile().delete(); // TODO-rca: エラーハンドリング } + @Override + public File createFile(String fileName) { + return currentDir.resolve(fileName).toFile(); + } + + @Override + public void removeFile(String fileName) { + currentDir.resolve(fileName).toFile().delete(); // TODO-rca: エラーハンドリング + } + + @Override public void saveBitmapAtCurrent(Bitmap bitmap, String fileName) { // TODO-rca: ファイル形式を変更できるようにする? try {