From ad268d496f01512f3b67afeb8d6c358c17559c82 Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Wed, 11 Mar 2026 12:21:39 -0500 Subject: Fix tracked writes false positives, stale entries, portability, and launcher self-destruct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove initialScan() from mount and unmount — its heuristic ("file exists in both overwrite and a mod") caused false-positive tracking of game-generated config files. Tracking now only happens through explicit UI actions or snapshot-based detectManualMoves(). - Prune stale tracked entries on load when mod folder no longer exists on disk. - Store mod paths as relative (to JSON file parent) for instance portability; legacy absolute paths auto-migrate on next save. - Guard launcher sync against HERE==BIN_DST to prevent rm -rf self-destruct when running directly from ~/.local/share/fluorine/bin/. Co-Authored-By: Claude Opus 4.6 --- docker/build-inner.sh | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'docker/build-inner.sh') diff --git a/docker/build-inner.sh b/docker/build-inner.sh index ca6bac7..3ced87f 100755 --- a/docker/build-inner.sh +++ b/docker/build-inner.sh @@ -330,16 +330,22 @@ export FLUORINE_ORIG_QT_PLUGIN_PATH="${QT_PLUGIN_PATH:-}" FLUORINE_DATA="${HOME}/.local/share/fluorine" BIN_DST="${FLUORINE_DATA}/bin" -# Use the main binary's mtime as a version fingerprint. -CURRENT_VER="$(stat -c '%i:%Y' "${HERE}/ModOrganizer-core" 2>/dev/null || echo "unknown")" -MARKER="${BIN_DST}/.version" - -if [ ! -f "${MARKER}" ] || [ "$(cat "${MARKER}" 2>/dev/null)" != "${CURRENT_VER}" ]; then - echo "Syncing Fluorine to ${BIN_DST}..." >&2 - rm -rf "${BIN_DST}" - mkdir -p "${BIN_DST}" - (cd "${HERE}" && tar --exclude-vcs -cf - .) | (cd "${BIN_DST}" && tar -xf -) - echo "${CURRENT_VER}" > "${MARKER}" +# Guard: if we ARE already running from the installed location, skip the sync. +# Without this, running the binary directly from BIN_DST would rm -rf itself. +HERE_REAL="$(readlink -f "${HERE}")" +DST_REAL="$(readlink -f "${BIN_DST}" 2>/dev/null || echo "")" +if [ "${HERE_REAL}" != "${DST_REAL}" ]; then + # Use the main binary's mtime as a version fingerprint. + CURRENT_VER="$(stat -c '%i:%Y' "${HERE}/ModOrganizer-core" 2>/dev/null || echo "unknown")" + MARKER="${BIN_DST}/.version" + + if [ ! -f "${MARKER}" ] || [ "$(cat "${MARKER}" 2>/dev/null)" != "${CURRENT_VER}" ]; then + echo "Syncing Fluorine to ${BIN_DST}..." >&2 + rm -rf "${BIN_DST}" + mkdir -p "${BIN_DST}" + (cd "${HERE}" && tar --exclude-vcs -cf - .) | (cd "${BIN_DST}" && tar -xf -) + echo "${CURRENT_VER}" > "${MARKER}" + fi fi # Run from the synced location. -- cgit v1.3.1