diff --git a/Toby Doom Launcher.py b/Toby Doom Launcher.py index 97708fe..56da56d 100755 --- a/Toby Doom Launcher.py +++ b/Toby Doom Launcher.py @@ -925,8 +925,14 @@ class DoomLauncher(QMainWindow): if platform.system() == "Windows": self.configFile = Path.cwd() / 'TobyConfig.ini' self.gamePath = Path.cwd() + self.searchPaths = [Path.cwd()] else: self.gamePath = Path.home() / ".local/games/doom" + # Additional search paths for Linux/Mac + self.searchPaths = [ + Path.home() / ".local/games/doom", + Path.home() / ".local/share/doom" + ] self.configFile = Path(os.getenv('XDG_CONFIG_HOME', Path.home() / '.config')) / 'gzdoom/gzdoom.ini' # Make sure controls are set @@ -1524,7 +1530,7 @@ class DoomLauncher(QMainWindow): matches = list(pathObj.parent.glob(pattern)) gameFiles.extend(str(p) for p in matches) else: - fullPath = self.gamePath / filePath + fullPath = self.find_file_in_paths(filePath) if fullPath.exists(): gameFiles.append(str(fullPath)) @@ -1544,7 +1550,7 @@ class DoomLauncher(QMainWindow): else: # Fall back to standard optional files priority for optFile in optional_files: - optPath = self.gamePath / optFile + optPath = self.find_file_in_paths(optFile) if optPath.exists(): gameFiles.append(str(optPath)) music_added = True @@ -1553,7 +1559,7 @@ class DoomLauncher(QMainWindow): # Add any remaining non-music optional files if not music_added: for optFile in optional_files: - optPath = self.gamePath / optFile + optPath = self.find_file_in_paths(optFile) if optPath.exists(): gameFiles.append(str(optPath)) break # Only add the first optional file found @@ -2485,10 +2491,19 @@ class DoomLauncher(QMainWindow): return customGames + def find_file_in_paths(self, filename: str) -> Path: + """Search for a file across all configured search paths""" + for search_path in self.searchPaths: + file_path = search_path / filename + if file_path.exists(): + return file_path + # Return default path if not found + return self.gamePath / filename + def check_dependencies(self, dependencies: List[dict]) -> bool: """Check if required files exist and show download info if not""" for dep in dependencies: - file_path = self.gamePath / dep['file'] + file_path = self.find_file_in_paths(dep['file']) if not file_path.exists(): message = [ f"You are missing the \"{dep['file']}\" Package.\n", @@ -2631,7 +2646,7 @@ class DoomLauncher(QMainWindow): matches = list(pathObj.parent.glob(pattern)) gameFiles.extend(str(p) for p in matches) else: - fullPath = self.gamePath / filePath + fullPath = self.find_file_in_paths(filePath) if fullPath.exists(): gameFiles.append(str(fullPath)) @@ -2651,7 +2666,7 @@ class DoomLauncher(QMainWindow): else: # Fall back to standard optional files priority for optFile in optional_files: - optPath = self.gamePath / optFile + optPath = self.find_file_in_paths(optFile) if optPath.exists(): gameFiles.append(str(optPath)) music_added = True @@ -2660,7 +2675,7 @@ class DoomLauncher(QMainWindow): # Add any remaining non-music optional files if not music_added: for optFile in optional_files: - optPath = self.gamePath / optFile + optPath = self.find_file_in_paths(optFile) if optPath.exists(): gameFiles.append(str(optPath)) break # Only add the first optional file found