diff --git a/patcher/apply-filter.js b/patcher/apply-filter.js index 28dbc4c..6d03854 100755 --- a/patcher/apply-filter.js +++ b/patcher/apply-filter.js @@ -24,12 +24,17 @@ function cp(src, dest) { var data = fs.readFileSync(src, 'utf-8'); fs.writeFileSync(dest, data); + return true } // let manifest = JSON.parse(fs.readFileSync('templates/.fontcustom-manifest.json', 'utf-8')) let fcyml = fs.readFileSync('../fontcustom.yml', 'utf-8') -let desired = fs.readFileSync('../wanted.ini', 'utf-8').split('\n').filter((x) => x.length && x[0] !== '#') +let desired = fs.readFileSync('../wanted.ini', 'utf-8').split('\n') + .filter((x) => x.length && x[0] !== '#') + .map((x) => x.trim().replace(/\s*#.*/, '')) + +// TODO deal with aliases properly console.log(`Including ${desired.length} icons`) @@ -72,7 +77,14 @@ rmInDir('../Fork-Awesome/src/icons/svg') console.log('Copying desired files to FA~svg/ ...') +let any_bad = false for (let a of desired) { - cp(`./templates/svg/${a}.svg`, `../Fork-Awesome/src/icons/svg/${a}.svg`) + if (!cp(`./templates/svg/${a}.svg`, `../Fork-Awesome/src/icons/svg/${a}.svg`)) { + console.log(`- \x1b[33mFile \x1b[31m"${a}.svg"\x1b[33m not found, probably a typo or alias\x1b[m`) + any_bad = true + } } +if (any_bad) { + console.log(`\x1b[31mSome files were not found. If you included their aliases (e.g. save -> floppy-o), this is correct.\x1b[m`) +}