diff --git a/modules/tga_converter.py b/modules/tga_converter.py index def71f6..02342d1 100644 --- a/modules/tga_converter.py +++ b/modules/tga_converter.py @@ -88,18 +88,32 @@ class TGAConverter: """ # Check default locations for path in self.DEFAULT_CACHE_PATHS: - if path.exists(): - # Check if this folder directly contains .tga files - if list(path.glob("*.tga")): - logger.info(f"Found cache folder: {path}") - self._cache_path = path - return path - # Check for subfolders (version folders like "19.3.2.201024") - for subfolder in path.iterdir(): - if subfolder.is_dir() and list(subfolder.glob("*.tga")): - logger.info(f"Found cache subfolder: {subfolder}") - self._cache_path = subfolder - return subfolder + if not path.exists(): + continue + + # Check if this folder directly contains .tga files + if list(path.glob("*.tga")): + logger.info(f"Found cache folder: {path}") + self._cache_path = path + return path + + # Check for subfolders (version folders like "19.3.2.201024") + for subfolder in path.iterdir(): + if not subfolder.is_dir(): + continue + + # Check if subfolder contains .tga files + if list(subfolder.glob("*.tga")): + logger.info(f"Found cache subfolder: {subfolder}") + self._cache_path = subfolder + return subfolder + + # Check one level deeper (in case of nested structure) + for nested in subfolder.iterdir(): + if nested.is_dir() and list(nested.glob("*.tga")): + logger.info(f"Found cache nested folder: {nested}") + self._cache_path = nested + return nested # Try to find by looking for .tga files logger.info("Searching for .tga files...") @@ -373,8 +387,8 @@ class TGAConverter: logger.error("Cache folder not found") return results - # Find all TGA files - tga_files = list(cache_path.glob("*.tga")) + # Find all TGA files (including in subfolders) + tga_files = list(cache_path.rglob("*.tga")) if not tga_files: logger.warning(f"No .tga files found in: {cache_path}")