1
0
mirror of https://github.com/one-among-us/data.git synced 2024-11-10 13:24:50 +08:00

[F] Generator: Mkdirs if not already exists

This commit is contained in:
Hykilpikonna 2021-11-12 13:59:05 -05:00
parent a6d8e7d531
commit 0d9198806f

View File

@ -1,5 +1,6 @@
import io import io
import os, json5 import os, json5
from pathlib import Path
if __name__ == '__main__': if __name__ == '__main__':
output = [] output = []
@ -10,5 +11,6 @@ if __name__ == '__main__':
o = json5.load(f) o = json5.load(f)
output.append({'path': p, 'id': o['id'], 'name': o['name'], 'profileUrl': o['profileUrl']}) output.append({'path': p, 'id': o['id'], 'name': o['name'], 'profileUrl': o['profileUrl']})
Path("generated").mkdir(parents=True, exist_ok=True)
with io.open('generated/people-list.json5', 'w', encoding='utf-8') as f: with io.open('generated/people-list.json5', 'w', encoding='utf-8') as f:
f.write(json5.dumps(output, indent=2, ensure_ascii=False)) f.write(json5.dumps(output, indent=2, ensure_ascii=False))