Skip to content
New issue

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

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

Already on GitHub? # to your account

Change the ballerina command to jballerina in vscode extension #15958

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -240,9 +240,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 @@ -312,7 +312,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 @@ -347,12 +347,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 @@ -361,7 +361,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 @@ -375,11 +375,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