feat(scanner): complete localized artifact quality checkpoint
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import path from "node:path";
|
||||
|
||||
export interface RuntimeResourcePathOptions {
|
||||
isPackaged: boolean;
|
||||
resourcesPath: string;
|
||||
currentWorkingDirectory: string;
|
||||
appPath: string;
|
||||
overridePath?: string;
|
||||
}
|
||||
|
||||
function uniqueCandidates(candidates: Array<string | undefined>) {
|
||||
return candidates.filter((candidate, index, all): candidate is string => (
|
||||
Boolean(candidate) && all.indexOf(candidate) === index
|
||||
));
|
||||
}
|
||||
|
||||
export function inputHelperPathCandidates({
|
||||
isPackaged,
|
||||
resourcesPath,
|
||||
currentWorkingDirectory,
|
||||
appPath,
|
||||
overridePath,
|
||||
}: RuntimeResourcePathOptions) {
|
||||
const packagedPath = path.join(resourcesPath, "input-helper", "InputHelper.exe");
|
||||
const developmentPaths = [
|
||||
path.join(currentWorkingDirectory, "native", "input-helper", "bin", "publish", "InputHelper.exe"),
|
||||
path.join(appPath, "native", "input-helper", "bin", "publish", "InputHelper.exe"),
|
||||
];
|
||||
|
||||
return uniqueCandidates([
|
||||
overridePath,
|
||||
...(isPackaged ? [packagedPath] : [...developmentPaths, packagedPath]),
|
||||
]);
|
||||
}
|
||||
|
||||
export function ikInventoryListsPathCandidates({
|
||||
isPackaged,
|
||||
resourcesPath,
|
||||
currentWorkingDirectory,
|
||||
appPath,
|
||||
overridePath,
|
||||
}: RuntimeResourcePathOptions) {
|
||||
const packagedPath = path.join(resourcesPath, "ik-inventorylists");
|
||||
const developmentPaths = [
|
||||
path.join(currentWorkingDirectory, "data", "ik-inventorylists"),
|
||||
path.join(appPath, "data", "ik-inventorylists"),
|
||||
];
|
||||
|
||||
return uniqueCandidates([
|
||||
overridePath,
|
||||
...(isPackaged ? [packagedPath] : [...developmentPaths, packagedPath]),
|
||||
]);
|
||||
}
|
||||
Reference in New Issue
Block a user