fix dll overrides & add disable UMU
This commit is contained in:
parent
5d5ca345f1
commit
8c6db38fab
12 changed files with 295 additions and 45 deletions
|
|
@ -1,6 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const fsp = require('fs').promises
|
||||
const fs = require('fs')
|
||||
const fsp = fs.promises
|
||||
const path = require('path')
|
||||
const { DIRS, resolvePortablePath } = require('./paths')
|
||||
const { newGame, newGameId, addGame } = require('./library')
|
||||
|
|
@ -82,8 +83,22 @@ async function importGameFromPrefix(prefix, srcDir, onProgress) {
|
|||
const driveRoots = prefixDriveRoots(prefix)
|
||||
if (!driveRoots.length) return { ok: false, error: 'no-drive-c' }
|
||||
const src = path.resolve(String(srcDir))
|
||||
// realpath on both sides: a unified prefix reaches drive_c through the pfx
|
||||
// symlink too, and that path is the same folder (see ensureUnifiedPrefix)
|
||||
let realSrc
|
||||
try {
|
||||
realSrc = fs.realpathSync(src)
|
||||
} catch {
|
||||
return { ok: false, error: 'outside-drive-c' }
|
||||
}
|
||||
const insideDrive = driveRoots.some(root => {
|
||||
const rel = path.relative(root, src)
|
||||
let realRoot
|
||||
try {
|
||||
realRoot = fs.realpathSync(root)
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
const rel = path.relative(realRoot, realSrc)
|
||||
return rel && !rel.startsWith('..') && !path.isAbsolute(rel)
|
||||
})
|
||||
if (!insideDrive) return { ok: false, error: 'outside-drive-c' }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue