improvemets & fixes:
- added 'open with' handling to desktop shortcuts - move logs button to app configuration - fix sync progress disappearing after long hashing - fix sync double file counter - merge wine and proton prefix folders via symlink
This commit is contained in:
parent
8c6db38fab
commit
59ff0b1088
15 changed files with 520 additions and 113 deletions
37
src/wines.js
37
src/wines.js
|
|
@ -167,14 +167,31 @@ function applyDisplayName(w) {
|
|||
// A build keeps its folder and id (apps point at the id, and prefix symlinks
|
||||
// point inside the folder), so "renaming" only changes the shown label.
|
||||
function setWineDisplayName(id, name) {
|
||||
const clean = normalizeLabel(name)
|
||||
if (!clean) return { ok: false, error: 'invalidName' }
|
||||
return writeWineLabel(id, clean)
|
||||
}
|
||||
|
||||
// Clears a custom label back to the folder-derived one: what the LAN sync
|
||||
// calls when the sender never renamed the build. The rename dialog never
|
||||
// clears - an empty name there is an error (setWineDisplayName above).
|
||||
function clearWineDisplayName(id) {
|
||||
return writeWineLabel(id, '')
|
||||
}
|
||||
|
||||
function writeWineLabel(id, clean) {
|
||||
const wines = getWines()
|
||||
const w = wines.find(x => x.id === id)
|
||||
if (!w) return { ok: false, error: 'notFound' }
|
||||
if (w.type === 'system') return { ok: false, error: 'isSystem' }
|
||||
const clean = normalizeLabel(name)
|
||||
if (!clean) return { ok: false, error: 'invalidName' }
|
||||
w.displayName = clean
|
||||
applyDisplayName(w)
|
||||
if (clean) {
|
||||
w.displayName = clean
|
||||
w.label = clean
|
||||
} else {
|
||||
if (!w.displayName) return { ok: true, displayName: '' }
|
||||
delete w.displayName
|
||||
w.label = labelFor(w.type, w.path, w.version)
|
||||
}
|
||||
writeJson(REGISTRY, wines.map(wineRel))
|
||||
return { ok: true, displayName: clean }
|
||||
}
|
||||
|
|
@ -241,6 +258,16 @@ async function fixBuildSymlinks(root) {
|
|||
// Everything a freshly arrived build needs before it can run: relative links
|
||||
// and executable binaries. Returns what was changed, for the callers' reports.
|
||||
async function healBuild(root) {
|
||||
// a build folder that IS a symlink (kept on another disk) is left alone:
|
||||
// the walk would follow the link and edit its target, which is not
|
||||
// necessarily part of this launcher's trees
|
||||
let st = null
|
||||
try {
|
||||
st = fs.lstatSync(root)
|
||||
} catch {
|
||||
return { links: 0, executables: 0 }
|
||||
}
|
||||
if (!st.isDirectory()) return { links: 0, executables: 0 }
|
||||
const links = await fixBuildSymlinks(root)
|
||||
const executables = await restoreExecutableBits(root)
|
||||
return { links, executables }
|
||||
|
|
@ -316,4 +343,4 @@ async function importWineFolder(srcDir, onProgress) {
|
|||
return { ok: true, path: toPortablePath(dst), symlinksFixed: healed.links, executablesFixed: healed.executables }
|
||||
}
|
||||
|
||||
module.exports = { refreshWines, getWines, getWine, resolveWine, setWineDisabled, setWineDisplayName, getDefaultWine, setDefaultWine, deleteWine, importWineFolder, findWineBinary, detectType, fixBuildSymlinks, healBuild }
|
||||
module.exports = { refreshWines, getWines, getWine, resolveWine, setWineDisabled, setWineDisplayName, clearWineDisplayName, getDefaultWine, setDefaultWine, deleteWine, importWineFolder, findWineBinary, detectType, fixBuildSymlinks, healBuild }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue