chickensoft-games / GodotEnv

Manage Godot versions and addons from the command line on Windows, macOS, and Linux.
https://www.nuget.org/packages/Chickensoft.GodotEnv/
MIT License
284 stars 9 forks source link

feat: support more forgiving input version strings #64

Open drako0812 opened 1 month ago

drako0812 commented 1 month ago

After installing the newest prerelease version of Godot using:

godotenv godot install 4.3.0-beta1

I tried to check to see if things were set up correctly so I ran:

godotenv godot list

And got the following output:

ERROR
System.NullReferenceException: Object reference not set to an instance of an object.
  at Chickensoft.GodotEnv.Features.Godot.Domain.GodotRepository.<>c.<GetInstallationsList>b__48_0(GodotInstallation i) in \home\runner\work\GodotEnv\GodotEnv\GodotEnv\src\features\godot\domain\GodotRepository.cs:595
  at System.Linq.EnumerableSorter`2.ComputeKeys(TElement[] elements, Int32 count)
  at System.Linq.EnumerableSorter`1.ComputeMap(TElement[] elements, Int32 count)
  at System.Linq.EnumerableSorter`1.Sort(TElement[] elements, Int32 count)
  at System.Linq.OrderedEnumerable`1.ToList()
  at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
  at Chickensoft.GodotEnv.Features.Godot.Domain.GodotRepository.GetInstallationsList() in \home\runner\work\GodotEnv\GodotEnv\GodotEnv\src\features\godot\domain\GodotRepository.cs:567
  at Chickensoft.GodotEnv.Features.Addons.Commands.GodotListCommand.ListLocalVersions(ILog log, IGodotRepository godotRepo) in \home\runner\work\GodotEnv\GodotEnv\GodotEnv\src\features\godot\commands\GodotListCommand.cs:25
  at Chickensoft.GodotEnv.Features.Addons.Commands.GodotListCommand.ExecuteAsync(IConsole console) in \home\runner\work\GodotEnv\GodotEnv\GodotEnv\src\features\godot\commands\GodotListCommand.cs:53
  at CliFx.CliApplication.RunAsync(ApplicationSchema applicationSchema, CommandInput commandInput) in \_\CliFx\CliApplication.cs:153
  at CliFx.CliApplication.RunAsync(IReadOnlyList`1 commandLineArguments, IReadOnlyDictionary`2 environmentVariables) in \_\CliFx\CliApplication.cs:193

My initial guess is that the new version doesn't quite match what godotenv is expecting, but I haven't looked at the code, so I'm not sure.

definitelyokay commented 1 month ago

Assuming you are using GodotEnv 2.1.1 (dotnet tool install -g Chickensoft.GodotEnv), you will want to specify the version the same way as the nuget GodotSharp format, with the dot between the label and the number. That would make the version string 4.3.0-beta.1.

I installed 4.3.0-beta.1 successfully and was able to list the versions after without any issue. To get your setup working again, try removing the directory where it installs Godot (~/.config/godotenv/godot/versions/godot_dotnet_4_3_0_beta_whatever) and reinstalling it with the correct version specifier. You may have to restart your terminal if you run into symlink issues.

We likely need to do some work to make the version specifier less picky so that it's harder to stumble into these pain points. In the meantime, please let me know if this resolves your issue.

drako0812 commented 1 month ago

Okay, yeah, I'll try that when I have a chance and report back.

EDIT: Yes it worked thanks!