cleanup comments, update translations, bump to 0.4.1
This commit is contained in:
parent
9edcc9841b
commit
7d8ab87eee
28 changed files with 412 additions and 1114 deletions
|
|
@ -1,9 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
// "Open with PLWL" (file manager -> Open With -> PLWL): a file handed in via
|
||||
// `--open <path>` (or the Exec %f plumbing) is parked here until the renderer
|
||||
// picks it up, then launched ad hoc with the wine version + prefix chosen in
|
||||
// the picker popup. Nothing is imported into the library.
|
||||
// "Open with PLWL": a file handed in via --open is parked here until the
|
||||
// renderer picks it up, then launched ad hoc. Nothing is imported.
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
|
@ -26,8 +24,7 @@ function clearPending() {
|
|||
pending = null
|
||||
}
|
||||
|
||||
// The launcher's own translations may not cover openwith texts in older
|
||||
// installs - fall back to English keys so the UI never shows raw key names.
|
||||
// Fall back to English keys on older installs.
|
||||
function textsFor(code) {
|
||||
let texts = {}
|
||||
try {
|
||||
|
|
@ -58,8 +55,7 @@ function resolvePrefix(name) {
|
|||
return known || defs.default || 'Main'
|
||||
}
|
||||
|
||||
// Ad-hoc run target: shaped exactly like a library game (runner.buildEnv and
|
||||
// the playtime/log paths expect those fields) but nothing is persisted.
|
||||
// Ad-hoc run target shaped like a library game; nothing persisted.
|
||||
function makeTarget(openPath, wineId, prefixName) {
|
||||
const dir = path.dirname(openPath)
|
||||
return {
|
||||
|
|
@ -82,9 +78,7 @@ function makeTarget(openPath, wineId, prefixName) {
|
|||
}
|
||||
}
|
||||
|
||||
// Launch without importing: resolves the chosen wine/prefix, builds the ad
|
||||
// hoc target and runs it exactly like a library app (same env, same logging,
|
||||
// same detached process group).
|
||||
// Launch without importing, exactly like a library app.
|
||||
async function run({ openPath, wine: wineId, prefix: prefixName0, lang, onStarted }) {
|
||||
if (!openPath || !fs.existsSync(openPath)) return { ok: false, error: 'file-missing' }
|
||||
if (!/\.(exe|msi|bat|cmd|lnk)$/i.test(openPath)) return { ok: false, error: 'not-windows' }
|
||||
|
|
@ -92,9 +86,7 @@ async function run({ openPath, wine: wineId, prefix: prefixName0, lang, onStarte
|
|||
const prefixName = resolvePrefix(prefixName0)
|
||||
const runner = require('./runner')
|
||||
try {
|
||||
// runAdHoc builds the synthetic target internally (shared `openwith` id,
|
||||
// so logs/playtime never collide with a library app id); the resolved
|
||||
// prefix is passed through so buildEnv uses the chosen one
|
||||
// shared `openwith` id keeps logs/playtime away from library ids
|
||||
const res = await runner.runAdHoc({ openPath, wine, systemWine: wine.type === 'system', prefix: prefixName })
|
||||
if (onStarted) onStarted({ name: path.basename(openPath), pid: res.pid })
|
||||
return { ok: true, pid: res.pid || null, logFile: res.logFile || null }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue