Skip to content

Commit

Permalink
Merge pull request #15958 from nadeeshaan/change-ballerina-command2
Browse files Browse the repository at this point in the history
Change the ballerina command to jballerina in vscode extension
  • Loading branch information
nadeeshaan authored Jun 24, 2019
2 parents d6148f4 + d659ec7 commit 2237ec2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tool-plugins/vscode/src/core/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ export class BallerinaExtension {
message: "Trying to get ballerina version without setting ballerina home."
});
}
let command = `${path.join(ballerinaHome, 'bin', 'ballerina')} version`;
let command = `${path.join(ballerinaHome, 'bin', 'jballerina')} version`;
if (process.platform === 'win32') {
command = `"${path.join(ballerinaHome, 'bin', 'ballerina.bat')}" version`;
command = `"${path.join(ballerinaHome, 'bin', 'jballerina.bat')}" version`;
}
return new Promise((resolve, reject) => {
exec(command, (err, stdout, stderr) => {
Expand Down Expand Up @@ -314,7 +314,7 @@ export class BallerinaExtension {


isValidBallerinaHome(homePath: string = this.ballerinaHome): boolean {
const ballerinaCmd = process.platform === 'win32' ? 'ballerina.bat' : 'ballerina';
const ballerinaCmd = process.platform === 'win32' ? 'jballerina.bat' : 'jballerina';
if (fs.existsSync(path.join(homePath, 'bin', ballerinaCmd))) {
return true;
}
Expand Down Expand Up @@ -355,12 +355,12 @@ export class BallerinaExtension {
return process.env.BALLERINA_HOME;
}
try {
ballerinaPath = execSync('where ballerina').toString().trim();
ballerinaPath = execSync('where jballerina').toString().trim();
} catch (error) {
return ballerinaPath;
}
if (ballerinaPath) {
ballerinaPath = ballerinaPath.replace(/bin\\ballerina.bat$/, '');
ballerinaPath = ballerinaPath.replace(/bin\\jballerina.bat$/, '');
}
break;
case 'darwin': // Mac OS
Expand All @@ -369,7 +369,7 @@ export class BallerinaExtension {
ballerinaPath = fs.realpathSync(output.toString().trim());
// remove ballerina bin from ballerinaPath
if (ballerinaPath) {
ballerinaPath = ballerinaPath.replace(/bin\/ballerina$/, '');
ballerinaPath = ballerinaPath.replace(/bin\/jballerina$/, '');
// For homebrew installations ballerina executable is in libexcec
const homebrewBallerinaPath = path.join(ballerinaPath, 'libexec');
if (fs.existsSync(homebrewBallerinaPath)) {
Expand All @@ -383,11 +383,11 @@ export class BallerinaExtension {
case 'linux': // Linux
// lets see where the ballerina command is.
try {
const output = execSync('which ballerina');
const output = execSync('which jballerina');
ballerinaPath = fs.realpathSync(output.toString().trim());
// remove ballerina bin from path
if (ballerinaPath) {
ballerinaPath = ballerinaPath.replace(/bin\/ballerina$/, '');
ballerinaPath = ballerinaPath.replace(/bin\/jballerina$/, '');
}
} catch {
return ballerinaPath;
Expand Down

0 comments on commit 2237ec2

Please # to comment.