mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
ファイル名から検索するメソッドを追加
This commit is contained in:
parent
656482e968
commit
1ee0a1b8ea
|
@ -22,6 +22,7 @@ public interface FileManager {
|
|||
void removeFile(String fileName);
|
||||
|
||||
boolean isExist(Path path);
|
||||
boolean isExist(String fileName);
|
||||
|
||||
void autoCreateDir(Path path);
|
||||
|
||||
|
|
|
@ -54,6 +54,17 @@ public class FileManagerImpl implements FileManager {
|
|||
this.currentDir = rootDir.resolve(dirName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeDir(Path path) {
|
||||
if (path.startsWith(rootDir)) {
|
||||
this.currentDir = path;
|
||||
}
|
||||
else {
|
||||
logger.debug("changeDir", "invalid path: " + path);
|
||||
// TODO-rca: 例外を投げる
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void backDir() {
|
||||
this.currentDir = currentDir.getParent();
|
||||
|
@ -115,6 +126,12 @@ public class FileManagerImpl implements FileManager {
|
|||
return Files.exists(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExist(String fileName) {
|
||||
logger.debug("isExist", "called");
|
||||
return Files.exists(currentDir.resolve(fileName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autoCreateDir(Path path) {
|
||||
logger.debug("autoCreateDir", "called");
|
||||
|
|
Loading…
Reference in New Issue
Block a user