code cleanup

This commit is contained in:
olcxja 2026-10-07 10:57:52 +02:00
commit bf5abeef73
6 changed files with 124 additions and 197 deletions

View file

@ -38,7 +38,6 @@ function loadGames() {
g[k] = usePrefix && isPrefixRel(g[k]) ? path.join(usePrefix, g[k]) : resolvePortablePath(g[k])
}
if (g.iconSource) g.iconSource = resolvePortablePath(g.iconSource)
// an entry written by an older launcher keeps its meaning
if (g.isolation !== undefined) g.isolation = isolationMode(g.isolation)
const ps = readPlaySeconds(g.id)
if (ps != null) g.playSeconds = ps
@ -116,19 +115,14 @@ function isLinuxGame(game) {
return !!game && game.kind === 'linux'
}
// none = plain run, relaxed = bwrap + the whole host filesystem mounted rw,
// isolated = bwrap + handed documents copied in, auto = relaxed where bwrap
// works and none where it does not.
// none = plain run, relaxed = whole host filesystem mounted writable, isolated
// = the stock read-only profile, auto = relaxed where bwrap works.
const ISOLATION_MODES = ['auto', 'none', 'relaxed', 'isolated']
// Modes written by launcher 0.5.x: `off` was the plain run, `require` was
// "bwrap or refuse" - which is exactly what the strictest level means now.
const LEGACY_ISOLATION_MODES = { off: 'none', require: 'isolated' }
// One known mode, always: an unknown value would otherwise reach the runner
// and pick something nobody asked for.
// One known mode, always: an unknown value would otherwise reach the runner and
// pick a level nobody asked for.
function isolationMode(value) {
const mode = LEGACY_ISOLATION_MODES[value] || value
return ISOLATION_MODES.includes(mode) ? mode : 'auto'
return ISOLATION_MODES.includes(value) ? value : 'auto'
}
function sanitizeLinuxPatch(patch) {