fixes:
- 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:
parent
b83e530392
commit
66f42f30cc
8 changed files with 74 additions and 10 deletions
|
|
@ -93,6 +93,8 @@ function registerIpc({ getWindow, onGamesChanged }) {
|
|||
// games: library -----------------------------------------------------------------
|
||||
ipcMain.handle('games:list', () => library.loadGames())
|
||||
ipcMain.handle('games:get', (e, id) => library.getGame(id))
|
||||
// prefix pin is enforced inside library.updateGame (prefix/importSource
|
||||
// fields are ignored for prefix imports), so nothing extra needed here
|
||||
ipcMain.handle('games:update', (e, id, patch) => library.updateGame(id, patch))
|
||||
ipcMain.handle('games:remove', (e, id) => {
|
||||
shortcuts.removeShortcut(id)
|
||||
|
|
@ -204,7 +206,15 @@ function registerIpc({ getWindow, onGamesChanged }) {
|
|||
|
||||
// dialogs & shell ---------------------------------------------------------------------------
|
||||
ipcMain.handle('dialog:pickFile', async (e, opts) => {
|
||||
const res = await dialog.showOpenDialog(getWindow(), { properties: ['openFile', 'openDirectory'], ...(opts || {}) })
|
||||
const o = { ...(opts || {}) }
|
||||
// Electron resolves a RELATIVE defaultPath against the process cwd (the
|
||||
// install root in packaged mode), which lands the picker somewhere
|
||||
// random like '/'. Renderer paths are FILES-relative by convention, so
|
||||
// anchor them there instead.
|
||||
if (o.defaultPath && typeof o.defaultPath === 'string' && !path.isAbsolute(o.defaultPath)) {
|
||||
o.defaultPath = path.join(DIRS.FILES, o.defaultPath)
|
||||
}
|
||||
const res = await dialog.showOpenDialog(getWindow(), { properties: ['openFile', 'openDirectory'], ...o })
|
||||
return res.canceled || !res.filePaths[0] ? null : res.filePaths[0]
|
||||
})
|
||||
ipcMain.handle('shell:openPath', (e, p) => shell.openPath(p))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue