From 480a57cf037a46f176128e6c94aa5616fcf704a3 Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Tue, 17 Feb 2026 23:59:40 -0600 Subject: Fix Wine prefix deployment, INI handling, and data directory paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix data directory path to use ~/.var/app/com.fluorine.manager consistently (was ~/.local/share/fluorine in committed code) - Fix VFS helper path in fuseconnector.cpp to use fluorineDataDir() - Fix localAppFolder() to resolve Wine prefix AppData/Local on Linux instead of returning XDG ~/.local/share - Add localAppName() virtual method for correct AppData folder mapping (Enderal→"enderal", Nehrim→"Oblivion") - Fix mergeTweak() to use direct INI parser instead of QSettings which corrupts backslashes and URL-encodes spaces in keys - Make resolveWineDataDirName() more robust with existence checks and fallback chain (documentsDirectory → gameShortName → gameName) - Add comprehensive debug logging throughout Wine prefix deployment - Fix INI case handling: copy instead of symlink for case-mismatched INIs, ensure both proper-case and lowercase aliases exist - Remove native build script (Flatpak only) Co-Authored-By: Claude Opus 4.6 --- src/plugins/rootbuilder.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src/plugins/rootbuilder.py') diff --git a/src/plugins/rootbuilder.py b/src/plugins/rootbuilder.py index fbe082c..dcc6706 100644 --- a/src/plugins/rootbuilder.py +++ b/src/plugins/rootbuilder.py @@ -69,8 +69,20 @@ def _host_cp(src: str, dst: str) -> bool: return False +def _ensure_readable(path: str): + """Ensure a file has owner-read permission (mod archives sometimes strip it).""" + try: + st = os.stat(path) + if not (st.st_mode & 0o400): + os.chmod(path, st.st_mode | 0o400) + except OSError: + pass + + def _reflink_copy(src: str, dst: str): """Copy with reflink (CoW) if supported, fallback to regular copy.""" + _ensure_readable(src) + last_err = None try: subprocess.run( ["cp", "--reflink=auto", "-f", "--", src, dst], @@ -78,16 +90,18 @@ def _reflink_copy(src: str, dst: str): capture_output=True, ) return - except (subprocess.CalledProcessError, FileNotFoundError): - pass + except subprocess.CalledProcessError as e: + last_err = f"cp failed (exit {e.returncode}): {e.stderr.decode(errors='replace').strip()}" + except FileNotFoundError: + last_err = "cp command not found" try: shutil.copy2(src, dst) return - except OSError: - pass + except OSError as e: + last_err = f"{e.strerror} (errno {e.errno})" if _IN_FLATPAK and _host_cp(src, dst): return - raise OSError(f"Root Builder: failed to copy {src} -> {dst}") + raise OSError(f"Root Builder: failed to copy {src} -> {dst}: {last_err}") def _ensure_writable(path: str): -- cgit v1.3.1