mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-30 03:23:16 +00:00
Impl実装 WIP
This commit is contained in:
parent
b28a939792
commit
e3d6826912
|
@ -3,6 +3,7 @@ package one.nem.lacerta.source.file.impl;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -19,8 +20,13 @@ public class FileManagerImpl implements FileManager {
|
||||||
|
|
||||||
// Internal Methods
|
// Internal Methods
|
||||||
private Path convertPath(String path) {
|
private Path convertPath(String path) {
|
||||||
|
Path convertedPath = currentDir.resolve(path);
|
||||||
|
if (convertedPath.startsWith(rootDir)) { // 異常なパスの場合はnullを返す // TODO-rca: エラーハンドリング
|
||||||
|
return convertedPath;
|
||||||
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public FileManagerImpl(Path rootDir) {
|
public FileManagerImpl(Path rootDir) {
|
||||||
|
@ -29,27 +35,28 @@ public class FileManagerImpl implements FileManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Path getRootDir() {
|
public Path getRootDir() {
|
||||||
return null;
|
return rootDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changeDir(String dirName) {
|
public void changeDir(String dirName) {
|
||||||
|
this.currentDir = rootDir.resolve(dirName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void backDir() {
|
public void backDir() {
|
||||||
|
this.currentDir = currentDir.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void backRootDir() {
|
public void backRootDir() {
|
||||||
|
this.currentDir = rootDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getDirList() {
|
public List<String> getDirList() {
|
||||||
return null;
|
// currentDirにあるディレクトリの一覧を返す
|
||||||
|
return Arrays.asList(currentDir.toFile().list());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user