- make prefix imported games paths relative to prefix
- show placeholder icon as fallback
- fix crossed working/exe directories
- fix broken working dir in prefix imported games
This commit is contained in:
olcxja 2026-09-30 16:27:31 +02:00
commit 66f42f30cc
8 changed files with 74 additions and 10 deletions

View file

@ -5,7 +5,7 @@ const path = require('path')
const { DIRS, resolvePortablePath } = require('./paths')
const { newGame, newGameId, addGame } = require('./library')
const { extractIconFromExe } = require('./icons')
const { prefixPath } = require('./prefixes')
const { listPrefixes, prefixDriveRoot } = require('./prefixes')
// Directories that typically hold installers/redistributables, not the game.
const SKIPPED_DIRS = new Set(['redist', 'directx', '_commonredist', 'support', 'dotnet', 'vc'])
@ -68,12 +68,11 @@ async function importGame(srcDir, mode, onProgress) {
// prefix, so wine sees the app exactly as if it had been installed
// normally into C:\...
async function importGameFromPrefix(prefix, srcDir, onProgress) {
const prefixes = require('./prefixes')
if (!prefixes.listPrefixes().prefixes.some(p => p.name === prefix)) return { ok: false, error: 'prefix-not-found' }
if (!listPrefixes().prefixes.some(p => p.name === prefix)) return { ok: false, error: 'prefix-not-found' }
// the folder must live inside the prefix's C: drive so the C:\ mapping
// holds - drive_c sits at the prefix top for plain wine, under pfx/ for
// Proton-managed prefixes
const driveRoot = prefixes.prefixDriveRoot(prefix)
const driveRoot = prefixDriveRoot(prefix)
if (!driveRoot) return { ok: false, error: 'no-drive-c' }
const rel = path.relative(driveRoot, srcDir)
if (!rel || rel.startsWith('..') || path.isAbsolute(rel)) return { ok: false, error: 'outside-drive-c' }