pathing for windows
CI / Build & Test (push) Successful in 3m35s

This commit is contained in:
Raven Scott
2026-03-07 01:14:46 -05:00
parent 7c306f182b
commit 375890d34c
+14 -1
View File
@@ -333,6 +333,17 @@ module.exports = EventEmitter;
if (v !== key) bundle.write(v, content)
}
}
// Real Windows (unlike Wine) may use case-insensitive or normalized path keys.
// Write lowercase variant so lookup finds content regardless of case.
const keyLower = key.toLowerCase()
if (keyLower !== key) bundle.write(keyLower, content)
const winKeyLower = winKey.toLowerCase()
if (winKeyLower !== winKey && winKeyLower !== key) bundle.write(winKeyLower, content)
// Relative-style keys (./package.json, .\node_modules\...)
const relForward = key.startsWith('/') ? '.' + key : './' + key.replace(/^\/+/, '')
if (relForward !== key) bundle.write(relForward, content)
const relBack = relForward.replace(/\//g, '\\')
if (relBack !== key && relBack !== winKey) bundle.write(relBack, content)
}
}
// Verification pass: ensure every .json key in the bundle has valid JSON content
@@ -343,7 +354,9 @@ module.exports = EventEmitter;
let content = bundle.read(key)
const valid = content && content.length > 0 && (() => { try { JSON.parse(content.toString()); return true } catch (_) { return false } })()
if (!valid) {
const diskPath = path.join(NATIVE_HOST_DIR, key.replace(/^[/\\]+/, '').replace(/[/\\]/g, path.sep))
// Normalize key to disk path: strip leading . and slashes, then use path.sep
const keyNorm = key.replace(/^\.?[/\\]+/, '').replace(/^[/\\]+/, '').replace(/[/\\]/g, path.sep)
const diskPath = path.join(NATIVE_HOST_DIR, keyNorm)
if (fs.existsSync(diskPath)) {
content = fs.readFileSync(diskPath)
bundle.write(key, content)