Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-11468] Fixed bug with keystore path not being validated properly. #3215

Merged
merged 1 commit into from
Oct 14, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 13 additions & 12 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,15 @@ exports.config = function (logger, config, cli) {
*/
'keystore': {
abbr: 'K',
desc: __('the location of the keystore'),
desc: __('the location of the keystore file'),
hint: 'path',
prompt: {
label: __('Keystore Location'),
error: __('Invalid keystore'),
label: __('Keystore File Location'),
error: __('Invalid keystore file'),
validator: function (keystorePath) {
if (!afs.exists(keystorePath) || !fs.statSync(keystorePath).isFile()) {
throw new appc.exception(__('Invalid keystore location'));
keystorePath = afs.resolvePath(keystorePath);
if (!afs.exists(keystorePath) || !fs.lstatSync(keystorePath).isFile()) {
throw new appc.exception(__('Invalid keystore file location'));
}
return true;
}
Expand Down Expand Up @@ -182,7 +183,7 @@ exports.config = function (logger, config, cli) {
}
}
});
});
}, config.android && config.android.sdkPath, config.android && config.android.ndkPath);
}
};

Expand All @@ -197,7 +198,7 @@ exports.validate = function (logger, config, cli) {
// we're running the build command for the wrong SDK version, gracefully return
return false;
}
if (!Object.keys(androidEnv.targets).length) {
if (!androidEnv || !Object.keys(androidEnv.targets).length) {
logger.error(__('Unable to detect Android SDK targets.') + '\n');
logger.log(__('Please download SDK targets via Android SDK Manager and try again. (version %s or newer)', version.format(minAndroidSdkVersion, 2)) + '\n');
process.exit(1);
Expand Down Expand Up @@ -257,14 +258,14 @@ exports.validate = function (logger, config, cli) {
process.exit(1);
}

if (!cli.argv['keystore']) {
logger.error(__('Invalid required option "--keystore"') + '\n');
if (!cli.argv.keystore) {
logger.error(__('Missing required keystore file path') + '\n');
process.exit(1);
}

cli.argv['keystore'] = afs.resolvePath(cli.argv['keystore']);
if (!afs.exists(cli.argv['keystore']) || !fs.statSync(cli.argv['keystore']).isFile()) {
logger.error(__('Invalid required option "--keystore"') + '\n');
cli.argv.keystore = afs.resolvePath(cli.argv.keystore);
if (!afs.exists(cli.argv.keystore) || !fs.statSync(cli.argv.keystore).isFile()) {
logger.error(__('Invalid keystore file "%s"', cli.argv.keystore) + '\n');
process.exit(1);
}

Expand Down