Skip to content

Commit

Permalink
Merge pull request #15 from jorrit/patch-2
Browse files Browse the repository at this point in the history
Improve directory existence check in simpleFsCache
  • Loading branch information
gillbeits authored Jan 21, 2019
2 parents abfef1d + 78f088a commit dc47ecd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,12 @@ function fontello (opts) {
* @returns {{get: 'get', set: 'set'}}
*/
fontello.simpleFsCache = function(cacheDir) {
if (!fs.lstatSync(cacheDir).isDirectory()) {
if (!fs.existsSync(cacheDir)) {
fs.mkdirSync(cacheDir);
}
if (!fs.lstatSync(cacheDir).isDirectory()) {
throw new PluginError(PLUGIN_NAME, "Path " + cacheDir + " must be a directory");
}

return {
'get': function(file, cb) {
Expand Down

0 comments on commit dc47ecd

Please sign in to comment.