add importing from prefix

This commit is contained in:
olcxja 2026-09-30 15:13:21 +02:00
commit b83e530392
11 changed files with 287 additions and 22 deletions

View file

@ -180,6 +180,27 @@ function registerIpc({ getWindow, onGamesChanged }) {
return errorResult(err)
}
})
// import from an existing wine prefix: pick the prefix first, then the app
// folder inside it (drive_c) - paths are stored prefix-relative so the app
// shows up for wine as a regular C:\ install
ipcMain.handle('games:pickPrefixFolder', async (e, prefix) => {
// open the picker straight in the prefix's C: drive (plain wine: top
// level, Proton: under pfx/)
const driveC = prefixes.prefixDriveRoot(prefix)
const res = await dialog.showOpenDialog(getWindow(), {
title: i18n.translate(library.loadSettings().language, 'import.pickPrefixFolder'),
defaultPath: driveC || prefixes.prefixPath(prefix),
properties: ['openDirectory']
})
return res.canceled || !res.filePaths[0] ? null : res.filePaths[0]
})
ipcMain.handle('games:importFromPrefix', async (e, prefix, srcDir) => {
try {
return await games.importFromPrefix(getWindow(), prefix, srcDir)
} catch (err) {
return errorResult(err)
}
})
// dialogs & shell ---------------------------------------------------------------------------
ipcMain.handle('dialog:pickFile', async (e, opts) => {