fix: Reload on adding a file
This commit is contained in:
parent
6af686f3bd
commit
2e8fdf67f1
10
src/files.py
10
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()
|
||||
|
||||
# -------------------------------
|
||||
|
|
Loading…
Reference in New Issue