1
0
Fork 0
mirror of https://github.com/Radiquum/anixart-patcher.git synced 2025-09-05 18:55:33 +05:00
anixart-patcher/patches/compress.py
2025-08-31 19:51:58 +05:00

25 lines
722 B
Python

"""Remove and Compress unnecessary resources"""
priority = 0
from tqdm import tqdm
import os
import shutil
from typing import TypedDict
class PatchConfig_Compress(TypedDict):
src: str
keep_dirs: list[str]
def apply(config: PatchConfig_Compress) -> bool:
for item in os.listdir(f"{config['src']}/unknown/"):
item_path = os.path.join(f"{config['src']}/unknown/", item)
if os.path.isfile(item_path):
os.remove(item_path)
tqdm.write(f"removed file: {item_path}")
elif os.path.isdir(item_path):
if item not in config["keep_dirs"]:
shutil.rmtree(item_path)
tqdm.write(f"removed directory: {item_path}")
return True