Last active
June 30, 2025 15:35
-
-
Save krisk0/c3385af4cd0b58769b680eadfa8a1608 to your computer and use it in GitHub Desktop.
Clauzewitz mod override explorer. Shows which files are overridden. Meant for Linux/MacOS, will not work under Windows without modification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| """ | |
| Input: list of mod directories g_dd. The dirs should be in load order | |
| Output: list of file overriden | |
| """ | |
| # The script probably will not work on Windows because of backslashes in file names | |
| ''' | |
| Load order: | |
| EK2 | |
| Carnalitas | |
| CBO Unofficial Base | |
| CBO Unofficial Animation (Optional) | |
| CBO Unofficial Mesh (Optional) | |
| EK2 CBO Base | |
| EK2 CBO Animation (Optional) | |
| EK2 CBO Mesh (Optional) | |
| ''' | |
| g_dd = [ | |
| 'ek.7apr', | |
| 'carnalitas-2.9', | |
| 'CBO_Unofficial_Base', | |
| 'EK2_CBO_Base', | |
| ] | |
| import glob | |
| def read_dir(d): | |
| s=set(glob.iglob(d + '/**/*.gui', recursive=True)) | |
| s |= set(glob.iglob(d + '/**/*.txt', recursive=True)) | |
| assert s | |
| cut_off = 1 + len(d) | |
| r = set([i[cut_off:].lower() for i in s]) | |
| print('Cached dir ' + d) | |
| return r | |
| def merge(ii): | |
| oo = [ii[0]] | |
| for j in range(1, len(ii)): | |
| oo.append(ii[j-1] | ii[j]) | |
| return oo | |
| def show_intersect(sou, mer): | |
| for i in range(1, len(sou)): | |
| common = sou[i] & mer[i - 1] | |
| if common: | |
| print('\n' + g_dd[i] + ' overrides') | |
| for c in common: | |
| print(' ' + c) | |
| g_sou = [read_dir(d) for d in g_dd] | |
| g_mer = merge(g_sou) | |
| show_intersect(g_sou, g_mer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment