diff --git a/source/src/main/java/one/nem/lacerta/source/file/FileManager.java b/source/src/main/java/one/nem/lacerta/source/file/FileManager.java index f1899e35..ef6bf92a 100644 --- a/source/src/main/java/one/nem/lacerta/source/file/FileManager.java +++ b/source/src/main/java/one/nem/lacerta/source/file/FileManager.java @@ -27,4 +27,5 @@ public interface FileManager { FileManager setRootDir(Path rootDir); FileManager setPath(Path path); FileManager setPath(String path); + FileManager resolve(String path); } diff --git a/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java b/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java index dea0d455..42b4184c 100644 --- a/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java +++ b/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java @@ -65,7 +65,6 @@ public class FileManagerImpl implements FileManager { return resolvedPath; } - @Override public File getFileRef() { return null; @@ -119,17 +118,30 @@ public class FileManagerImpl implements FileManager { @Override public FileManager setPath(Path path) { - if (path.startsWith(this.rootDir)) { + if (this.disableRootDirCheck) { this.path = path; } else { - if (this.autoCreate) { - + if (path.startsWith(this.rootDir)) { + this.path = path; + } else { + throw new IllegalArgumentException("path must be in rootDir"); } } + return this; } @Override public FileManager setPath(String path) { return null; } + + @Override + public FileManager resolve(String path) { + try { + this.path = resolveStringPath(path); + } catch (IOException e) { + e.printStackTrace(); + } + } + }