diff --git a/src/level.py b/src/level.py index 20c173a..f30474c 100644 --- a/src/level.py +++ b/src/level.py @@ -58,11 +58,18 @@ class Level: ambientFile = levelData["ambience"] # Build list of paths to try (pack-specific first, then generic) + # Include both PyInstaller-aware absolute paths and relative paths for compatibility ambiencePaths = [] soundsDir = get_sounds_directory_path() if self.levelPackName: + # PyInstaller-aware absolute path ambiencePaths.append(os.path.join(soundsDir, self.levelPackName, "ambience", ambientFile)) + # Original relative path (for compatibility) + ambiencePaths.append(f"sounds/{self.levelPackName}/ambience/{ambientFile}") + # PyInstaller-aware absolute path ambiencePaths.append(os.path.join(soundsDir, "ambience", ambientFile)) + # Original relative path (for compatibility) + ambiencePaths.append(f"sounds/ambience/{ambientFile}") # Try each path until one works for ambiencePath in ambiencePaths: