mirror of
https://github.com/Radiquum/anixart-patcher.git
synced 2025-09-06 03:03:50 +05:00
25 lines
722 B
Python
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
|