Skip to content

Commit 2ec08f3

Browse files
authored
Merge pull request wso2#262 from axewilledge/devant-url
Fixes for windows issues
2 parents 3a4ec97 + ecc49a1 commit 2ec08f3

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

workspaces/ballerina/ballerina-extension/src/core/extension.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -813,10 +813,12 @@ export class BallerinaExtension {
813813
// Set the executable permissions
814814
await this.setExecutablePermissions();
815815

816-
// Set the Ballerina version
817-
const filePath = path.join(this.ballerinaInstallationDir, 'distributions', 'ballerina-version');
818-
fs.writeFileSync(filePath, `ballerina-${latestDistributionVersion}`);
819-
console.log(`Updated ${filePath} with version: ${latestDistributionVersion}`);
816+
// Set the Ballerina version in ballerina-version files
817+
const distributionFilePath = path.join(this.ballerinaInstallationDir, 'distributions', 'ballerina-version');
818+
const ballerinaUserHomeFilePath = path.join(this.getBallerinaUserHome(), 'ballerina-version');
819+
fs.writeFileSync(distributionFilePath, `ballerina-${latestDistributionVersion}`);
820+
fs.writeFileSync(ballerinaUserHomeFilePath, `ballerina-${latestDistributionVersion}`);
821+
console.log(`Updated ${distributionFilePath} and ${ballerinaUserHomeFilePath} with version: ${latestDistributionVersion}`);
820822

821823
// Set the Ballerina Home and Command for the user
822824
this.setBallerinaCommandForUser();

workspaces/ballerina/ballerina-extension/src/utils/project-artifacts.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export async function buildProjectArtifactsStructure(projectDir: string, langCli
6060
export async function updateProjectArtifacts(publishedArtifacts: ArtifactsNotification): Promise<void> {
6161
// Current project structure
6262
const currentProjectStructure: ProjectStructureResponse = StateMachine.context().projectStructure;
63-
const projectUri = URI.parse(StateMachine.context().projectUri);
64-
const isWithinProject = URI.parse(publishedArtifacts.uri).path.toLowerCase().includes(projectUri.path.toLowerCase());
63+
const projectUri = URI.file(StateMachine.context().projectUri);
64+
const isWithinProject = URI.parse(publishedArtifacts.uri).fsPath.toLowerCase().includes(projectUri.fsPath.toLowerCase());
6565
if (currentProjectStructure && isWithinProject) {
6666
const entryLocations = await traverseUpdatedComponents(publishedArtifacts.artifacts, currentProjectStructure);
6767
const notificationHandler = ArtifactNotificationHandler.getInstance();
@@ -104,7 +104,7 @@ async function getComponents(artifacts: Record<string, BaseArtifact>, artifactTy
104104
}
105105

106106
async function getEntryValue(artifact: BaseArtifact, icon: string, moduleName?: string) {
107-
const targetFile = Utils.joinPath(URI.parse(StateMachine.context().projectUri), artifact.location.fileName).fsPath;
107+
const targetFile = Utils.joinPath(URI.file(StateMachine.context().projectUri), artifact.location.fileName).fsPath;
108108
const entryValue: ProjectStructureArtifactResponse = {
109109
id: artifact.id,
110110
name: artifact.name,
@@ -183,7 +183,7 @@ async function injectAIAgent(serviceArtifact: BaseArtifact) {
183183
const agentName = serviceArtifact.name.split('-')[1].trim().replace(/\//g, '');
184184

185185
// Retrieve the service model
186-
const targetFile = Utils.joinPath(URI.parse(StateMachine.context().projectUri), serviceArtifact.location.fileName).fsPath;
186+
const targetFile = Utils.joinPath(URI.file(StateMachine.context().projectUri), serviceArtifact.location.fileName).fsPath;
187187
const updatedService = await new ServiceDesignerRpcManager().getServiceModelFromCode({
188188
filePath: targetFile,
189189
codedata: {

0 commit comments

Comments
 (0)