Op Some Code

main
ColdWindScholar 2023-11-04 18:24:44 +08:00
parent 913d84ba01
commit 776833f5d3
1 changed files with 3 additions and 4 deletions

View File

@ -50,6 +50,7 @@ def fs_patch(fs_file, dir_path) -> tuple: # 接收两个字典对比
new_fs = {}
new_add = 0
r_fs = {}
print("FsPatcher: Load origin %d" % (len(fs_file.keys())) + " entries")
for i in scan_dir(os.path.abspath(dir_path)):
if fs_file.get(i):
new_fs[i] = fs_file[i]
@ -113,9 +114,7 @@ def fs_patch(fs_file, dir_path) -> tuple: # 接收两个字典对比
def main(dir_path, fs_config) -> None:
origin_fs = scanfs(os.path.abspath(fs_config))
new_fs, new_add = fs_patch(origin_fs, dir_path)
new_fs, new_add = fs_patch(scanfs(os.path.abspath(fs_config)), dir_path)
with open(fs_config, "w", encoding='utf-8', newline='\n') as f:
f.writelines([i + " " + " ".join(new_fs[i]) + "\n" for i in sorted(new_fs.keys())])
print("Load origin %d" % (len(origin_fs.keys())) + " entries")
print('Add %d' % new_add + " entries")
print('FsPatcher: Add %d' % new_add + " entries")