| 1234567891011121314151617 |
- import fs from "fs";
- export function getJsonData(file: string): unknown {
- const str = fs.readFileSync(file).toString();
- return JSON.parse(str);
- }
- const appDataPath =
- process.env["AppData"] || `${process.env["HOME"] ?? ""}/Library/Application Support`;
- export const factorioPath = `${appDataPath}/Factorio`;
- type Locale = Record<string, string>;
- export function getLocale(file: string): Locale {
- const path = `${factorioPath}/script-output/${file}`;
- return getJsonData(path) as Locale;
- }
|