Impl実装 WIP

This commit is contained in:
ろむねこ 2023-12-21 14:59:12 +09:00 committed by r-ca
parent 7e7d72f903
commit 60544c7905
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -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<String> getDirList() {
return null;
// currentDirにあるディレクトリの一覧を返す
return Arrays.asList(currentDir.toFile().list());
}
@Override