From e3d682691299bd37e2629ce278bf45558f2ec617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 21 Dec 2023 14:59:12 +0900 Subject: [PATCH] =?UTF-8?q?Impl=E5=AE=9F=E8=A3=85=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/file/impl/FileManagerImpl.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 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 390b7975..43e19657 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 @@ -3,6 +3,7 @@ package one.nem.lacerta.source.file.impl; import android.graphics.Bitmap; import java.nio.file.Path; +import java.util.Arrays; import java.util.List; import javax.inject.Inject; @@ -19,7 +20,12 @@ public class FileManagerImpl implements FileManager { // Internal Methods private Path convertPath(String path) { - return null; + Path convertedPath = currentDir.resolve(path); + if (convertedPath.startsWith(rootDir)) { // 異常なパスの場合はnullを返す // TODO-rca: エラーハンドリング + return convertedPath; + } else { + return null; + } } @Inject @@ -29,27 +35,28 @@ public class FileManagerImpl implements FileManager { @Override public Path getRootDir() { - return null; + return rootDir; } @Override public void changeDir(String dirName) { - + this.currentDir = rootDir.resolve(dirName); } @Override public void backDir() { - + this.currentDir = currentDir.getParent(); } @Override public void backRootDir() { - + this.currentDir = rootDir; } @Override public List getDirList() { - return null; + // currentDirにあるディレクトリの一覧を返す + return Arrays.asList(currentDir.toFile().list()); } @Override