diff --git a/gamefile.py b/gamefile.py index c283c9c..122d15d 100644 --- a/gamefile.py +++ b/gamefile.py @@ -38,9 +38,9 @@ def __init__(self, path: str): self.file_path = path self.backup_path = path + ".bak" self.meta_path = path + ".patched" - self.game_name = self.get_game_name(path) + self.game_name = "The Sims 2*" self.name = os.path.basename(path) - self.relative_path = self.file_path.split(self.game_name)[1][1:] + self.relative_path = path self.backed_up = os.path.exists(self.backup_path) self.patched = False @@ -57,7 +57,7 @@ def get_game_name(self, file_path) -> str: Identify the game name by going up a directory until we find "filelist.txt", the root of the game installation, and take the name from this directory. """ - return "The Sims 2 Ultimate Collection" + return "The Sims 2*" path = os.path.realpath(file_path) root_count = len(path.split(os.sep)) while root_count > 2: diff --git a/sims2_4k_ui_patcher.py b/sims2_4k_ui_patcher.py index 55a0689..d450ac3 100755 --- a/sims2_4k_ui_patcher.py +++ b/sims2_4k_ui_patcher.py @@ -89,7 +89,7 @@ def get_resource(relative_path): self.banner_image.pack(side=tk.LEFT, padx=8, pady=8) # Create group box to select game files - self.groupbox1 = ttk.LabelFrame(self, text="EA Games folder") + self.groupbox1 = ttk.LabelFrame(self, text="Game Folder") self.groupbox1.pack(padx=8, pady=8, expand=True) self.input_dir = ttk.Entry(self.groupbox1, width=50) self.input_dir.grid(column=0, row=0, padx=8, pady=8) @@ -200,7 +200,7 @@ def _browse(self): if os.path.exists(path): initial_dir = path break - dirname = filedialog.askdirectory(initialdir=initial_dir, title="Select EA GAMES directory", mustexist=True) + dirname = filedialog.askdirectory(initialdir=initial_dir, title="Select The Sims 2 directory", mustexist=True) if not dirname: return @@ -231,7 +231,7 @@ def get_all_patchable_files(self) -> list: """ files = [] for filename in ["ui.package", "FontStyle.ini", "CaSIEUI.data"]: - files += glob.glob(os.path.join(self.ea_games_dir, "*Sims 2*", f"**/**/TSData/**/{filename}"), recursive=True) + files += glob.glob(f"{self.ea_games_dir}/**/{filename}", recursive=True) return sorted(list(set(files))) def refresh_game_status(self): @@ -253,7 +253,7 @@ def refresh_game_status(self): # Make sure we have a valid game directory if not patch_list: messagebox.showerror("Wrong folder selected", "No installation of The Sims 2 (or its expansion packs) was found in this folder.") - self.set_status_bar_text("Missing EA Games Folder") + self.set_status_bar_text("Missing Game Folder") return # Gather list of game files