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