- Fix the naming convention in Electron output to align with previous artifact naming to not break external/internal URLs. - In desktop execution tests, make artifact locator logic stricter to test regression.
22 lines
546 B
TypeScript
22 lines
546 B
TypeScript
import { readdir, access } from 'fs/promises';
|
|
import { constants } from 'fs';
|
|
|
|
export async function exists(path: string): Promise<boolean> {
|
|
if (!path) { throw new Error('Missing path'); }
|
|
try {
|
|
await access(path, constants.F_OK);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
export async function isDirMissingOrEmpty(dir: string): Promise<boolean> {
|
|
if (!dir) { throw new Error('Missing directory'); }
|
|
if (!await exists(dir)) {
|
|
return true;
|
|
}
|
|
const contents = await readdir(dir);
|
|
return contents.length === 0;
|
|
}
|