TGUI v3.0

This ports TGUI, and makes the old nano crew monitor and the disposal
bins use it as first examples.
This commit is contained in:
ShadowLarkens
2020-07-02 15:40:21 -07:00
parent 98535d6699
commit 1cded01770
187 changed files with 22079 additions and 80 deletions

View File

@@ -0,0 +1,26 @@
import glob from 'glob';
import { resolve as resolvePath } from 'path';
import fs from 'fs';
import { promisify } from 'util';
export { resolvePath };
/**
* Combines path.resolve with glob patterns.
*/
export const resolveGlob = async (...sections) => {
const unsafePaths = await promisify(glob)(
resolvePath(...sections), {
strict: false,
silent: true,
});
const safePaths = [];
for (let path of unsafePaths) {
try {
await promisify(fs.stat)(path);
safePaths.push(path);
}
catch {}
}
return safePaths;
};