From 871d5530be6077807796a97a072c436c959ec9bc Mon Sep 17 00:00:00 2001 From: DevGeniusCode <136935333+DevGeniusCode@users.noreply.github.com> Date: Sat, 11 Apr 2026 16:39:54 +0300 Subject: [PATCH 1/2] chore(script): add safety check for identical files during unification and move files --- scripts/cpp/unify_move_files.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index a5ce1f522dc..bf9c271f3fa 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -4,6 +4,7 @@ import os import shutil +import filecmp from enum import Enum @@ -79,6 +80,14 @@ def unify_file(fromGame: Game, fromFile: str, toGame: Game, toFile: str): fromGamePath = get_game_path(fromGame) toGamePath = get_game_path(toGame) + # Safety Identical Check + fullFromPath = os.path.join(fromGamePath, os.path.normpath(fromFile)) + fullOppositePath = os.path.join(fromOppositeGamePath, os.path.normpath(fromFile)) + + if not filecmp.cmp(fullFromPath, fullOppositePath, shallow=False): + print(f"ERROR: Files are not identical! Skipping to prevent data loss: {fromFile}") + return + fromFirstFolderIndex = fromFile.find("/") toFirstFolderIndex = toFile.find("/") assert(fromFirstFolderIndex > 0) From e5b601d8d7f4843bad629d8d2198f0babcb1aa01 Mon Sep 17 00:00:00 2001 From: DevGeniusCode <136935333+DevGeniusCode@users.noreply.github.com> Date: Sat, 11 Apr 2026 18:13:20 +0300 Subject: [PATCH 2/2] Fix FileNotFoundError Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- scripts/cpp/unify_move_files.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index bf9c271f3fa..abfaa44d9d2 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -84,6 +84,10 @@ def unify_file(fromGame: Game, fromFile: str, toGame: Game, toFile: str): fullFromPath = os.path.join(fromGamePath, os.path.normpath(fromFile)) fullOppositePath = os.path.join(fromOppositeGamePath, os.path.normpath(fromFile)) + if not os.path.exists(fullFromPath) or not os.path.exists(fullOppositePath): + print(f"ERROR: One or both files do not exist! Skipping: {fromFile}") + return + if not filecmp.cmp(fullFromPath, fullOppositePath, shallow=False): print(f"ERROR: Files are not identical! Skipping to prevent data loss: {fromFile}") return