fix syncing unselected apps from prefix

This commit is contained in:
olcxja 2026-10-20 07:44:11 +02:00
commit 02d296b7f1
5 changed files with 58 additions and 9 deletions

View file

@ -208,15 +208,24 @@ function createPusher(api) {
// A prefix app a selection leaves out stays on this side: its folder must not
// travel with the prefix, and the receiver must not prune it as a leftover.
// Every unselected prefix app inside the unit is found by where its folder
// really is, not by the prefix name it was registered with. The path is named
// the way the prefix walk names it: a folder imported through the unified
// `pfx` link is "drive_c/..." in the manifest, and the stored spelling alone
// would never match - the folder would travel.
function prefixExcludes(name, sel) {
const rootRel = `wineprefixes/${name}`
const out = []
for (const game of library.loadGames()) {
if (api.appCategory(game) !== 'apps-prefix' || game.prefix !== name) continue
if (api.appCategory(game) !== 'apps-prefix') continue
if (sel.has(`app:${game.id}`, game.id)) continue
const rel = String(toPortablePath(library.appFolder(game)) || '')
if (rel === rootRel || !rel.startsWith(rootRel + '/')) continue
out.push(rel)
const folder = library.appFolder(game)
const inPrefix = prefixes.prefixRelFor(name, folder)
const candidates = [inPrefix ? `${rootRel}/${inPrefix}` : '', String(toPortablePath(folder) || '')]
for (const rel of candidates) {
if (rel === rootRel || !rel.startsWith(rootRel + '/')) continue
if (!out.includes(rel)) out.push(rel)
}
}
return out
}