fix: better cache folder detection with nested subfolder support
- Now checks 2 levels deep for TGA files (handles version subfolders like 19.3.2.201024) - convert_cache_folder now uses rglob to find TGA files in all subfolders - Will auto-detect the version folder in ProgramData
This commit is contained in:
parent
6983d74f34
commit
c4aab56a9e
|
|
@ -88,19 +88,33 @@ class TGAConverter:
|
||||||
"""
|
"""
|
||||||
# Check default locations
|
# Check default locations
|
||||||
for path in self.DEFAULT_CACHE_PATHS:
|
for path in self.DEFAULT_CACHE_PATHS:
|
||||||
if path.exists():
|
if not path.exists():
|
||||||
|
continue
|
||||||
|
|
||||||
# Check if this folder directly contains .tga files
|
# Check if this folder directly contains .tga files
|
||||||
if list(path.glob("*.tga")):
|
if list(path.glob("*.tga")):
|
||||||
logger.info(f"Found cache folder: {path}")
|
logger.info(f"Found cache folder: {path}")
|
||||||
self._cache_path = path
|
self._cache_path = path
|
||||||
return path
|
return path
|
||||||
|
|
||||||
# Check for subfolders (version folders like "19.3.2.201024")
|
# Check for subfolders (version folders like "19.3.2.201024")
|
||||||
for subfolder in path.iterdir():
|
for subfolder in path.iterdir():
|
||||||
if subfolder.is_dir() and list(subfolder.glob("*.tga")):
|
if not subfolder.is_dir():
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Check if subfolder contains .tga files
|
||||||
|
if list(subfolder.glob("*.tga")):
|
||||||
logger.info(f"Found cache subfolder: {subfolder}")
|
logger.info(f"Found cache subfolder: {subfolder}")
|
||||||
self._cache_path = subfolder
|
self._cache_path = subfolder
|
||||||
return 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
|
# Try to find by looking for .tga files
|
||||||
logger.info("Searching for .tga files...")
|
logger.info("Searching for .tga files...")
|
||||||
docs_path = Path.home() / "Documents" / "Entropia Universe"
|
docs_path = Path.home() / "Documents" / "Entropia Universe"
|
||||||
|
|
@ -373,8 +387,8 @@ class TGAConverter:
|
||||||
logger.error("Cache folder not found")
|
logger.error("Cache folder not found")
|
||||||
return results
|
return results
|
||||||
|
|
||||||
# Find all TGA files
|
# Find all TGA files (including in subfolders)
|
||||||
tga_files = list(cache_path.glob("*.tga"))
|
tga_files = list(cache_path.rglob("*.tga"))
|
||||||
|
|
||||||
if not tga_files:
|
if not tga_files:
|
||||||
logger.warning(f"No .tga files found in: {cache_path}")
|
logger.warning(f"No .tga files found in: {cache_path}")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue