diff --git a/src/files.py b/src/files.py index 3f16da0..59b4639 100644 --- a/src/files.py +++ b/src/files.py @@ -2,6 +2,9 @@ import os import posixpath from typing import Self +# TODO: Cut any dependency of DocumentNode on the backend implementation +# Maybe use some king of "yield" to achieve this? + class DocumentNode(): def __init__(self, name: str, children: list): @@ -75,6 +78,11 @@ class DocumentTree(): def get_node(self, path: str) -> DocumentNode | None: return self.root.get_child(path) + def reload(self) -> bool: + # TODO: Instead of doing this, actually reload + self.root = DocumentNode.get_tree(self.base, '') + return True + # ----- Document Operations ----- # Split and remerge for Windows @@ -93,4 +101,6 @@ class DocumentTree(): with open(internal_path, 'w') as file: file.write(text) + self.reload() + # -------------------------------