2024-03-10 12:50:25 -05:00
|
|
|
import { readdir } from 'fs/promises';
|
2024-02-20 11:21:01 -06:00
|
|
|
import { argv } from 'process';
|
|
|
|
|
|
2025-01-14 19:22:41 -06:00
|
|
|
const WINDOWS_APPS = 'C:/Program Files/WindowsApps';
|
|
|
|
|
const wotbPackageRegex = /7458BE2C\..+_\d+(\.\d+)+_x64__.+/;
|
|
|
|
|
|
2024-02-20 11:21:01 -06:00
|
|
|
const isDepot = argv.includes('--depot');
|
2024-08-14 14:04:06 -05:00
|
|
|
|
2025-01-14 19:22:41 -06:00
|
|
|
let data: string;
|
|
|
|
|
let compressed: boolean;
|
|
|
|
|
|
|
|
|
|
if (isDepot) {
|
|
|
|
|
const [installationVersion] = await readdir(`../../depots/444202`);
|
|
|
|
|
data = `../../depots/444202/${installationVersion}/Data`;
|
|
|
|
|
compressed = true;
|
|
|
|
|
} else {
|
|
|
|
|
const directories = await readdir(WINDOWS_APPS).then((files) =>
|
|
|
|
|
files.filter((file) => wotbPackageRegex.test(file)),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (directories.length !== 1) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
`Expected 1 directory for WoTB Windows App, got ${directories.length}.`,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const [windowsApp] = directories;
|
|
|
|
|
data = `${WINDOWS_APPS}/${windowsApp}/Data`;
|
|
|
|
|
compressed = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const DATA = data;
|
|
|
|
|
export const DATA_COMPRESSED = compressed;
|