From 0a1b71f1252089f6ac0676ece4e2c5c126697b43 Mon Sep 17 00:00:00 2001 From: Byoungro So Date: Sun, 21 Feb 2016 16:25:21 -0800 Subject: [PATCH] CB-10660 fixed the exception when removing a non-existing directory. This closes #261 --- bin/templates/cordova/lib/pluginHandlers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/templates/cordova/lib/pluginHandlers.js b/bin/templates/cordova/lib/pluginHandlers.js index 381734d7..efbeda88 100644 --- a/bin/templates/cordova/lib/pluginHandlers.js +++ b/bin/templates/cordova/lib/pluginHandlers.js @@ -96,7 +96,7 @@ var handlers = { subDir = path.resolve(project.projectDir, subRelativeDir); // If it's the last framework in the plugin, remove the parent directory. var parDir = path.dirname(subDir); - if (fs.readdirSync(parDir).length === 0) { + if (fs.existsSync(parDir) && fs.readdirSync(parDir).length === 0) { fs.rmdirSync(parDir); } } else {