import streamlit as st from pathlib import Path WORKSPACE = Path("workspace") WORKSPACE.mkdir(exist_ok=True) class FileManager: def __init__(self, base_path=Path("workspace")): self.base_path = Path(base_path) self.base_path.mkdir(exist_ok=True) # read_file content # save_file content def get_file_tree(self): def build_tree(path: Path): tree = {} for item in sorted(path.iterdir()): if item.is_dir(): tree[item.name] = build_tree(item) else: tree[item.name] = None return tree return build_tree(self.base_path) if __name__ == "__main__": FileManager()