impl: Create folders if they don't exist
This commit is contained in:
parent
903f648b58
commit
b4066c1552
|
@ -97,7 +97,8 @@ class DocumentTree():
|
|||
def document_write(self, path: str, text: str) -> None:
|
||||
internal_path = os.path.join(self.base, *path.split('/')) + '.md'
|
||||
|
||||
# TODO: Check if the directory exists before writing
|
||||
# TODO: Probably add some sort of confirmation beforehand?
|
||||
os.makedirs(os.path.dirname(internal_path))
|
||||
with open(internal_path, 'w') as file:
|
||||
file.write(text)
|
||||
|
||||
|
|
Loading…
Reference in New Issue