add installer to build package

This commit is contained in:
olcxja 2026-09-25 20:38:23 +02:00
commit ada55faf13
88 changed files with 10828 additions and 25 deletions

View file

@ -20,6 +20,10 @@ function writeIconThemeDirs(png) {
const sizes = { '16x16': 16, '32x32': 32, '48x48': 48, '256x256': 256 }
const home = process.env.HOME
if (!home) return
const exe = path.join(require('./paths').APP_ROOT, 'plwl')
const execPath = fs.existsSync(exe)
? exe
: (process.env.PLWL_EXEC || 'plwl')
const base = path.join(home, '.local', 'share', 'icons')
for (const [dir, size] of Object.entries(sizes)) {
const themeDir = path.join(base, 'hicolor', dir, 'apps')
@ -33,7 +37,7 @@ function writeIconThemeDirs(png) {
'Type=Application',
`Name=${APP_NAME}`,
'Comment=Portable Linux Wine Launcher',
'Exec=plwl',
`Exec=${execPath}`,
`Icon=plwl`,
'Terminal=false',
'Categories=Game;'

View file

@ -3,10 +3,36 @@
const path = require('path')
const fs = require('fs')
const APP_ROOT = path.resolve(__dirname, '..')
// Packaged builds run from <portable root>/electron/resources/app.asar:
// the portable layout (<root>/files) is two levels above the resources dir
// and files bundled with the release are unpacked next to the asar.
function computeRoots() {
const m = __dirname.match(/^(.*)[/\\]app\.asar([/\\]|$)/)
if (m) {
const RESOURCES = path.resolve(m[1])
const APP_ROOT = path.resolve(RESOURCES, '..', '..')
return {
RESOURCES,
APP_ROOT,
// FILES = BUILD/files, so BUILD is the portable root itself.
BUILD: process.env.PLWL_BUILD_DIR || APP_ROOT,
// Bundled release files live inside the asar (Electron's patched fs
// can read them directly from the archive).
BUNDLED: fs.existsSync(path.join(RESOURCES, 'app.asar', 'files', 'translations'))
? path.join(RESOURCES, 'app.asar', 'files')
: path.join(APP_ROOT, 'files')
}
}
const APP_ROOT = path.resolve(__dirname, '..')
return {
RESOURCES: APP_ROOT,
APP_ROOT,
BUILD: process.env.PLWL_BUILD_DIR || path.join(APP_ROOT, 'build'),
BUNDLED: path.join(APP_ROOT, 'files')
}
}
const BUILD = process.env.PLWL_BUILD_DIR || path.join(APP_ROOT, 'build')
const BUNDLED = path.join(APP_ROOT, 'files')
const { RESOURCES, APP_ROOT, BUILD, BUNDLED } = computeRoots()
const FILES = path.join(BUILD, 'files')
const DATA = path.join(FILES, 'data')
@ -53,4 +79,4 @@ function writeJson(file, data) {
fs.renameSync(tmp, file)
}
module.exports = { APP_ROOT, BUILD, FILES, DATA, DIRS, ensureDirs, readJson, writeJson }
module.exports = { RESOURCES, APP_ROOT, BUILD, FILES, DATA, DIRS, ensureDirs, readJson, writeJson }