いくつかのメソッドで対応する引数を増やした

This commit is contained in:
r-ca 2024-01-08 11:38:05 +09:00
parent 1ee0a1b8ea
commit 88cd58f920
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9
2 changed files with 32 additions and 0 deletions

View File

@ -16,7 +16,9 @@ public interface FileManager {
void backRootDir(); //cd /
List<Path> getList();
void createDir(String dirName);
void createDir(Path path);
void removeDir(String dirName);
void removeDir(Path path);
File createFile(String fileName);
void removeFile(String fileName);
@ -25,6 +27,7 @@ public interface FileManager {
boolean isExist(String fileName);
void autoCreateDir(Path path);
void autoCreateDir(String dirName);
void autoCreateToCurrentDir();

View File

@ -102,12 +102,29 @@ public class FileManagerImpl implements FileManager {
}
}
@Override
public void createDir(Path path) {
logger.debug("createDir", "called");
try {
Files.createDirectory(path);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void removeDir(String dirName) {
logger.debug("removeDir", "called");
currentDir.resolve(dirName).toFile().delete(); // TODO-rca: エラーハンドリング
}
@Override
public void removeDir(Path path) {
logger.debug("removeDir", "called");
path.toFile().delete(); // TODO-rca: エラーハンドリング
}
@Override
public File createFile(String fileName) {
logger.debug("createFile", "called");
@ -144,6 +161,18 @@ public class FileManagerImpl implements FileManager {
}
}
@Override
public void autoCreateDir(String dirName) {
logger.debug("autoCreateDir", "called");
if (!Files.exists(currentDir.resolve(dirName))) {
try {
Files.createDirectories(currentDir.resolve(dirName));
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public void autoCreateToCurrentDir() {
logger.debug("autoGenerateToCurrentDir", "called");