2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-12-23 02:28:55 +00:00

Fix #117 ENOENT when infering flash

This commit is contained in:
Jia Hao 2016-02-26 03:13:11 +08:00
parent 866991d6a1
commit 0ed5bd8c7b

View File

@ -29,8 +29,18 @@ function inferFlash() {
*/ */
function findSync(pattern, base, findDir) { function findSync(pattern, base, findDir) {
const matches = []; const matches = [];
(function findSyncRecurse(base) { (function findSyncRecurse(base) {
const children = fs.readdirSync(base); let children;
try {
children = fs.readdirSync(base);
} catch (exception) {
if (exception.code === 'ENOENT') {
return;
}
throw exception;
}
children.forEach(child => { children.forEach(child => {
const childPath = path.join(base, child); const childPath = path.join(base, child);
const childIsDirectory = fs.lstatSync(childPath).isDirectory(); const childIsDirectory = fs.lstatSync(childPath).isDirectory();