Skip to content

Commit

Permalink
Fix Some Bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdWindScholar committed Nov 4, 2023
1 parent cca1ca0 commit 34ec50d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions contextpatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def context_patch(fs_file, dir_path) -> tuple: # 接收两个字典对比
r_new_fs = {}
add_new = 0
permission_d = None
print("ContextPatcher: Load origin %d" % (len(fs_file.keys())) + " entries")
try:
permission_d = fs_file.get(list(fs_file)[5])
except IndexError:
Expand Down Expand Up @@ -67,9 +68,7 @@ def context_patch(fs_file, dir_path) -> tuple: # 接收两个字典对比


def main(dir_path, fs_config) -> None:
origin = scan_context(os.path.abspath(fs_config))
new_fs, add_new = context_patch(origin, dir_path)
new_fs, add_new = context_patch(scan_context(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.keys())) + " entries")
print('Add %d' % add_new + " entries")
print('ContextPatcher: Add %d' % add_new + " entries")
7 changes: 3 additions & 4 deletions fspatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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")

0 comments on commit 34ec50d

Please sign in to comment.