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

Unexpected ballerina version switch when multiple local distributions are available and .ballerina directory is deleted #349

Open
lochana-chathura opened this issue Apr 1, 2024 · 2 comments
Labels

Comments

@lochana-chathura
Copy link
Member

Description:
When you have multiple ballerina distributions available locally and you delete the .ballerina directory, the active distribution automatically gets switched to the oldest locally available version.

In my case, I was using 2201.8.6 and the old one I had in my machine was 2201.5.0. The version got switched to the 5.0 after deleting the said directory.

Affected Versions:
Update Tool 1.4.2 at least

OS, DB, other environment details and versions:
MacOS

@lochana-chathura
Copy link
Member Author

Related comments:

  • "update tool reads the current version from the text file ballerina-version in .ballerina folder. This may be the reason"
    Originally commented by @NipunaMadhushan in the chat.

  • "By default, it sets the initially downloaded/installed ballerina distribution as the default distribution if we haven't defined it in .ballerina"
    Originally commented by @dulajdilshan in the chat.

@dulajdilshan
Copy link

We may need to keep track of the default ballerina version (not the using version) separately in the ballerina-distribution directory itself because if we keep it in .ballerina directory, that information may get lost if deletion of the directory.

To give some idea on what nvm does ->
In nvm (https://github.com/nvm-sh/nvm - we use this to manage NPM). Even though we use nvm use v18.0 command to use node v18.0, we have to set the default version to use it as the default else we may have to set the using node version again.

For Ballerina's case, we can have two options.

  1. Keep two variables to keep the default version and the in-use version (in .ballerina directory).
  2. Keep only one variable to keep the currently in-use version. This variable needs to be kept in the ballerina-distribution installation directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants