[O] Use file.parent instead of splitting /

This commit is contained in:
Hykilpikonna
2021-11-24 19:28:25 -05:00
parent b39611c226
commit 4aaaa3c349
+1 -2
View File
@@ -82,8 +82,7 @@ def write(file: str, text: str) -> None:
file = file.lower().replace('\\', '/')
if '/' in file:
path = '/'.join(file.split('/')[:-1])
Path(path).mkdir(parents=True, exist_ok=True)
Path(file).parent.mkdir(parents=True, exist_ok=True)
with open(file, 'w', encoding='utf-8') as f:
f.write(text)