From 5882b06047e342e556c850f31b6436103a70ee3d Mon Sep 17 00:00:00 2001 From: Michael Pobega Date: Mon, 15 Jun 2026 09:56:26 -0400 Subject: [PATCH] TrimUI: guard samefile() against missing target on first port install os.path.samefile() stats both paths passed to it; on first-time port installs the 'target' may not yet exist, resulting in a FileNotFoundError which aborts the installation. Short-circuit this check by checking that the target exists before executing the os.path.samefile() comparison. If the target doesn't exist then we flow directly into the code below (as if the samefile check failed.) --- PortMaster/pylibs/harbourmaster/platform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PortMaster/pylibs/harbourmaster/platform.py b/PortMaster/pylibs/harbourmaster/platform.py index 3d80cd8..bd26f43 100755 --- a/PortMaster/pylibs/harbourmaster/platform.py +++ b/PortMaster/pylibs/harbourmaster/platform.py @@ -1073,7 +1073,7 @@ def add_port_script(self, port_script): if port_mode == 'roms': target_file = ROM_SCRIPT_DIR / (port_script.name) - if not os.path.samefile(port_script, target_file): + if not target_file.exists() or not os.path.samefile(port_script, target_file): logger.debug(f"Copying {str(port_script)} to {str(target_file)}") shutil.copy(port_script, target_file) else: