17 lines
777 B
Python
17 lines
777 B
Python
# -*- coding: utf-8 -*-
|
|
import os, json
|
|
ROOT = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\0aaaa4f2f16c46e8964025a5ab0ecc02'
|
|
bad = []
|
|
for pack in ['behavior_pack_kcH4M5u0', 'resource_pack_t7eJjrxY']:
|
|
for dp, dn, fn in os.walk(os.path.join(ROOT, pack)):
|
|
for n in fn:
|
|
if n.endswith('.json'):
|
|
p = os.path.join(dp, n)
|
|
try:
|
|
with open(p, encoding='utf-8') as f:
|
|
json.load(f)
|
|
except Exception as e:
|
|
bad.append('%s :: %s' % (os.path.relpath(p, ROOT), e))
|
|
with open(os.path.join(ROOT, '_sa_hanhua_out', '_tmp', 'json_check.txt'), 'w', encoding='utf-8') as f:
|
|
f.write('\n'.join(bad) if bad else 'ALL JSON OK')
|
|
print('bad=%d' % len(bad)) |