f409ffad12
- baked-gitea-channel: http:// for brassnet mirror. - win-game-dir: map Unix /home/... to Z:\ under win32 (Wine folder picker). - resolveGameDir + saveGameDir + patch paths use it; Wow.exe resolved case-insensitively. - Version 1.0.6; README checklist for Wine. Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
724 B
JavaScript
22 lines
724 B
JavaScript
'use strict';
|
|
|
|
const path = require('path');
|
|
|
|
/**
|
|
* Under Wine, the folder picker often returns a Unix absolute path (/home/...).
|
|
* Windows Node does not resolve that to the WoW install; map to Wine's Z: drive
|
|
* (Z: == / on typical Wine prefixes).
|
|
*/
|
|
function normalizeWinGameDir(gameDir) {
|
|
if (process.platform !== 'win32') return String(gameDir || '').trim();
|
|
let s = String(gameDir || '').trim();
|
|
if (!s) return s;
|
|
s = s.replace(/\//g, path.win32.sep);
|
|
if (s.startsWith('\\\\')) return path.normalize(s);
|
|
if (/^[A-Za-z]:/.test(s)) return path.normalize(s);
|
|
if (s.startsWith(path.win32.sep)) return path.win32.normalize(`Z:${s}`);
|
|
return path.normalize(s);
|
|
}
|
|
|
|
module.exports = { normalizeWinGameDir };
|