diff --git a/src/modules/creator.js b/src/modules/creator.js index bcad3de..1f618f6 100644 --- a/src/modules/creator.js +++ b/src/modules/creator.js @@ -5,6 +5,7 @@ const config = require('../modules/config'); const downloader = require('./downloader'); const frontendlib = require('../modules/frontendlib'); const utils = require('../utils'); +const path = require('path'); module.exports.createApp = async (binaryName, template) => { if (fs.existsSync(`./${binaryName}`)) { @@ -36,7 +37,14 @@ module.exports.createApp = async (binaryName, template) => { catch(err) { utils.error('Unable to download resources from internet.' + ' Please check your internet connection and template URLs.'); - fse.removeSync(`../${binaryName}`); + + const parentDirPath = path.resolve('..'); + const binaryPath = path.resolve('.'); + process.chdir(parentDirPath); + fse.removeSync(binaryPath) + + utils.log(`Removed created directory. (${binaryName})`); + process.exit(1); }