file_manager: provide method to look up paths by root

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan
2025-01-17 11:01:06 -05:00
parent 152837959a
commit 636626506a

View File

@@ -372,6 +372,12 @@ class FileManager:
return ""
return os.path.relpath(full_path, start=root_dir)
def get_full_path(self, root: str, relative_path: str) -> pathlib.Path:
root_dir = self.file_paths.get(root, None)
if root_dir is None:
raise self.server.error(f"Unknown root {root}")
return pathlib.Path(root_dir).joinpath(relative_path)
def get_metadata_storage(self) -> MetadataStorage:
return self.gcode_metadata