unity-find-fault
Version:
A tool to find fault in unity project.
34 lines • 913 B
JavaScript
import fs from 'fs-extra';
import iconv from 'iconv-lite';
import { toolchain } from '../toolchain.js';
import path from 'path';
import normalizePath from 'normalize-path';
export function strArrayToMap(arr) {
const out = {};
for (const e of arr) {
out[e] = true;
}
return out;
}
export async function readGB2312(file) {
const content = await fs.readFile(file);
return iconv.decode(content, 'gbk');
}
export async function writeGB2312(file, content) {
const buff = iconv.encode(content, 'gbk');
await fs.writeFile(file, buff);
}
export function eitherExists(...choices) {
for (const c of choices) {
if (fs.existsSync(c))
return c;
}
return null;
}
export function standardPath(p) {
if (path.isAbsolute(p)) {
p = path.relative(toolchain.opts.projectRoot, p);
}
return normalizePath(p);
}
//# sourceMappingURL=vendor.js.map