Last active
June 20, 2021 07:44
-
-
Save woctezuma/f4faef1210e49ed06cf4725bac60998f to your computer and use it in GitHub Desktop.
Fix Roguebook
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
# References: | |
# - https://gist.github.com/woctezuma/f4faef1210e49ed06cf4725bac60998f | |
# - https://steamcommunity.com/app/1076200/discussions/0/3070873501572457641/ | |
from collections import Counter | |
from pathlib import Path | |
import glob | |
import os | |
game_path = "C:/Applis/Steam/steamapps/common/Roguebook/" | |
card_path = "Roguebook_Data/StreamingAssets/GameBoxResources/cards_scripts/" | |
file_path = game_path + card_path | |
print(file_path) | |
files = glob.glob(file_path + '*.xlb') | |
ids = [Path(fname).name.split('.')[0] for fname in files] | |
c = Counter(ids) | |
duplicates = [id for id in c if c[id]>1] | |
for id in duplicates: | |
files = glob.glob(file_path + id + '*.xlb') | |
files.sort(key=os.path.getmtime) | |
for fname in files[:-1]: | |
print(fname) | |
Path(fname).rename(fname + '.old') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
However, there is another error: