Revert "Revert "WIP""

This reverts commit 1b676f8368.
This commit is contained in:
r-ca 2024-01-09 15:18:31 +09:00
parent 1efac1ffb6
commit 65a25ad228
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -153,22 +153,22 @@ public class FileManagerImpl implements FileManager {
@Override @Override
public FileManager setRootDir(Path rootDir) { public FileManager setRootDir(Path rootDir) {
this.rootDir = rootDir; return this.newInstance(rootDir, this.path, this.autoCreateParent, this.disableRootDirCheck);
return this;
} }
@Override @Override
public FileManager setPath(Path path) { public FileManager setPath(Path path) {
Path resolvedPath;
if (this.disableRootDirCheck) { if (this.disableRootDirCheck) {
this.path = path; resolvedPath = path;
} else { } else {
if (path.startsWith(this.rootDir)) { if (path.startsWith(this.rootDir)) {
this.path = path; resolvedPath = path;
} else { } else {
throw new IllegalArgumentException("path must be in rootDir"); throw new IllegalArgumentException("path must be in rootDir");
} }
} }
return this; return this.newInstance(this.rootDir, resolvedPath, this.autoCreateParent, this.disableRootDirCheck);
} }
@Override @Override