def __init__(self, path): self.seta(path=path) path = PowerDirPath(self.geta('path')) if path.exists(): assert path.isfile() dic = json_load(path) assert isinstance(dic, dict) else: dic = {} path.tofile() json_dump(dic, path, indent=4) super().__init__(dic)
def file(self, name): path = self._truepath(name) p = PowerDirPath(path) p.tofile() return p