Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
MobileWebBuilder.prototype.createBuildDirs = function createBuildDirs(next) {
// Make sure we have an app.js. This used to be validated in validate(), but since plugins like
// Alloy generate an app.js, it may not have existed during validate(), but should exist now
// that build.pre.compile was fired.
ti.validateAppJsExists(this.projectDir, this.logger, 'mobileweb');
if (fs.existsSync(this.buildDir)) {
this.logger.debug(__('Deleting existing build directory'));
try {
wrench.rmdirSyncRecursive(this.buildDir);
} catch (e) {
this.logger.error(__('Failed to remove build directory: %s', this.buildDir));
if (e.message.indexOf('resource busy or locked') != -1) {
this.logger.error(__('Build directory is busy or locked'));
this.logger.error(__('Check that you don\'t have any terminal sessions or programs with open files in the build directory') + '\n');
} else {
this.logger.error(e.message + '\n');
}
process.exit(1);
}
}
function checkAppJs(next) {
// Make sure we have an app.js. This used to be validated in validate(), but since plugins like
// Alloy generate an app.js, it may not have existed during validate(), but should exist now
// that build.pre.compile was fired.
ti.validateAppJsExists(this.projectDir, this.logger, 'windows');
next();
}