[EXPERIMENTAL] linux apps support

This commit is contained in:
olcxja 2026-10-06 20:54:16 +02:00
commit e7636afe3d
20 changed files with 1377 additions and 101 deletions

View file

@ -38,6 +38,20 @@ function prefixPath(name) {
return path.join(DIRS.PREFIXES, name)
}
// Native Linux apps keep their redirected home/config/cache in here, next to
// the Windows side of the same prefix.
const LINUX_PFX = 'linux_pfx'
function prefixLinuxRoot(name) {
return path.join(prefixPath(name), LINUX_PFX)
}
// Native Linux app data is machine-local (sockets, caches, machine-id, the
// sandbox's home): a sync neither sends it nor deletes it as an extra.
function isLocalOnlyRel(rel) {
return String(rel || '').split('/').includes(LINUX_PFX)
}
function prefixExists(name) {
try {
fs.accessSync(prefixPath(name))
@ -100,6 +114,7 @@ function isPrefixRoot(p) {
const root = prefixPath(entry.name)
if (abs === root || abs === path.join(root, 'pfx')) return true
if (abs === path.join(root, 'drive_c') || abs === path.join(root, 'pfx', 'drive_c')) return true
if (abs === path.join(root, LINUX_PFX) || abs === path.join(root, LINUX_PFX, 'home')) return true
}
return false
}
@ -173,4 +188,4 @@ function setDefaultPrefix(name) {
return { ok: true }
}
module.exports = { isPrefixRel, PREFIX_REL_RE, listPrefixes, savePrefixes, createPrefix, deletePrefix, renamePrefix, setDefaultPrefix, prefixPath, prefixExists, prefixDriveRoots, isPrefixRoot, healPrefix, ensureUnifiedPrefix, MAIN }
module.exports = { isPrefixRel, PREFIX_REL_RE, LINUX_PFX, isLocalOnlyRel, listPrefixes, savePrefixes, createPrefix, deletePrefix, renamePrefix, setDefaultPrefix, prefixPath, prefixLinuxRoot, prefixExists, prefixDriveRoots, isPrefixRoot, healPrefix, ensureUnifiedPrefix, MAIN }