Giter Site home page Giter Site logo

chickensoft-games / godotenv Goto Github PK

View Code? Open in Web Editor NEW
258.0 5.0 7.0 878 KB

Manage Godot versions and addons from the command line on Windows, macOS, and Linux.

Home Page: https://www.nuget.org/packages/Chickensoft.GodotEnv/

License: MIT License

C# 98.89% Shell 1.11%
addon addons gamedev godot godot-addon godot-engine godot-game-engine godot3 utilities utility

godotenv's Introduction

GodotEnv

Chickensoft Badge Discord

GodotEnv is a command-line tool that makes it easy to switch between Godot versions and manage addons in your projects.


GodotEnv


GodotEnv can do the following:

  • ✅ Download, extract, and install Godot 3.0/4.0+ versions from the command line on Windows, macOS, and Linux (similar to tools like NVM, FVM, asdf, etc.
  • ✅ Switch the active version of Godot by updating a symlink.
  • ✅ Automatically setup a user GODOT environment variable that always points to the active version of Godot.
  • ✅ Install addons in a Godot project from local paths, remote git repositories, or symlinks using an easy-to-understand addons.json file. No more fighting with git submodules! Just run godotenv addons install whenever your addons.json file changes.
  • ✅ Automatically create and configure a .gitignore, addons.json, and addons/.editorconfig in your project to make it easy to manage addons.
  • ✅ Allow addons to declare dependencies on other addons using a flat dependency graph.

📦 Installation

GodotEnv is a .NET command line tool that runs on Windows, macOS, and Linux.

dotnet tool install --global Chickensoft.GodotEnv

GodotEnv uses the local git installation and other processes available from the shell, so make sure you've installed git and configured your local shell environment correctly.

⧉ On Windows, certain operations may require administrator privileges, such as managing symlinks or editing certain files. GodotEnv should prompt you in these cases for your approval, and certain operations will cause a command line window to pop open for a moment before disappearing — this is normal.

Quick Start

We'll walk through the commands in depth below, but if you prefer to get started right away you can use the --help flag with any command to get more information.

# Overall help
godotenv --help

# Help for entire categories of commands
godotenv godot --help
godotenv addons --help

# Help for a specific godot management command
godotenv godot install --help

# etc...

🤖 Godot Version Management

GodotEnv can automatically manage Godot versions on your local machine for you.

🙋‍♀️ Using GodotEnv to install Godot works best for local development. If you want to install Godot directly on a GitHub actions runner for CI/CD purposes, consider using Chickensoft's setup-godot action — it caches Godot installations between runs, installs the Godot export templates, and also works on Windows, macOS, and Ubuntu GitHub runners.

Installing Godot

To get started managing Godot versions with GodotEnv, you'll need to first instruct GodotEnv to install a version of Godot.

godotenv godot install 4.0.1
# or a non-stable version:
godotenv godot install 4.1.1-rc.1

Versions should match the format of the versions shown on the GodotSharp nuget package. Downloads are made from GitHub Release Builds.

By default, GodotEnv installs .NET-enabled versions of Godot.

If you really must install the boring, non-.NET version of Godot, you may do so 😢.

godotenv godot install 4.0.1 --no-dotnet

When installing a version of Godot, GodotEnv performs the following steps:

  • 📦 Downloads Godot installation zip archive (if not already downloaded).
  • 🤐 Extracts Godot installation zip archive.
  • 📂 Activates the newly installed version by updating the symlink.
  • 🏝 Makes sure the user GODOT environment variable points to the active Godot version symlink.

Listing Godot Versions

GodotEnv can show you a list of the Godot versions you have installed.

godotenv godot list

Which might produce something like the following, depending on what you have installed:

4.0.1
4.0.1 *dotnet
4.1.1-rc.1
4.1.1-rc.1 *dotnet

Listing Available Godot Versions

GodotEnv also supports showing a list of remote Godot versions available to install using the -r option.

godotenv godot list -r

Using a Different Godot Version

You can change the active version of Godot by instructing GodotEnv to update the symlink to one of the installed versions. By default, it only looks for the .NET-enabled version of Godot. To use a non-.NET version of Godot, specify --no-dotnet.

# uses dotnet version
godotenv godot use 4.0.1

# uses non-dotnet version
godotenv godot use 4.0.1 --no-dotnet

Uninstalling a Godot Version

Uninstalling works the same way as installing and switching versions does.

# uninstalls .NET version
godotenv godot uninstall 4.0.1

# uninstalls not-dotnet version
godotenv godot uninstall 4.0.1 --no-dotnet

Getting the Symlink Path

GodotEnv can provide the path to the symlink that always points to the active version of Godot.

godotenv godot env path

Getting the Active Godot Version Path

GodotEnv will provide you with the path to the active version of Godot that the symlink it uses is currently pointing to.

godotenv godot env target

Getting and Setting the GODOT Environment Variable

You can use GodotEnv to set the GODOT user environment variable to the symlink that always points to the active version of Godot.

# Set the GODOT environment variable to the symlink that GodotEnv maintains.
godotenv godot env setup

# Print the value of the GODOT environment variable.
godotenv godot env get

On Windows, this adds the GODOT environment variable to the current user's environment variable config.

On macOS, this adds the GODOT environment variable to the current user's default shell configuration file. In case the user's shell isn't compatible, defaults to zsh.

On Linux, this adds the GODOT environment variable to the current user's default shell configuration file. In case the user's shell isn't compatible, defaults to bash.

After making changes to environment variables on any system, be sure to close any open terminals and open a new one to ensure the changes are picked up. If changes are not picked up across other applications, you may have to log out and log back in. Fortunately, since the environment variable points to a symlink which points to the active Godot version, you only have to do this once! Afterwards, you are free to switch Godot versions without any further headache as often as you like.

🧼 Clearing the Godot Installers Download Cache

GodotEnv caches the Godot installation zip archives it downloads in a cache folder. You can ask GodotEnv to clear the cache folder for you.

godotenv cache clear

🔌 Addon Management

GodotEnv allows you to install Godot addons. A Godot addon is a collection of Godot assets and/or scripts that can be copied into a project. By convention, these are stored in a folder named addons relative to your Godot project. Check out the Dialogue Manager addon to see how a Godot addon itself is structured.

Besides copying addons from remote sources, GodotEnv allows you to install addons from a local git repository or symlink to local directories on your machine so that you can develop an addon across multiple Godot projects.

Using GodotEnv to manage addons can prevent some of the headaches that occur when using git submodules or manually managing symlinks.

Additionally, GodotEnv will check for accidental modifications made to addon content files before re-installing addons in your project to prevent overwriting changes you have made. It does this by turning non-symlinked addons into their own temporary git repositories and checking for changes before uninstalling them and reinstalling them.

When to Use Godot Addons

If you're using C#, you have two ways of sharing code: Godot addons and nuget packages. Each should be used in different scenarios.

  • 🔌 Addons allow scenes, scripts, or any other Godot assets and files to be reused in multiple Godot projects.

  • 📦 Nuget packages only allow C# code to be bundled into a library which can be used across multiple Godot projects.

If you're just sharing C# code between projects, you should use a nuget package or reference another .csproj locally. If you need to share scenes, resources, or any other type of files, use a Godot addon.

Why use an addon manager for Godot?

Managing addons in Godot projects has historically been somewhat problematic:

  • If you copy and paste an addon into multiple projects, and then modify the addon in one of the projects, the other projects won't get any updates you've made. Duplicated code across projects leads to code getting out of sync, developer frustration, and forgetting which one is most up-to-date.

  • If you want to share addons between projects, you might be tempted to use git submodules. Unfortunately, git submodules can be very finnicky when switching branches, and you have to be mindful of which commit you've checked out. Submodules are not known for being friendly to use and can be extremely fragile, even when used by experienced developers.

  • GodotEnv allows addons to declare dependencies on other addons. While this isn't a common use case, it will still check for various types of conflicts when resolving addons in a flat dependency graph and warn you if it detects any potential issues.

Using an addons.json file allows developers to declare which addons their project needs, and then forget about how to get them. Whenever the addons.json file changes across branches, you can just simply reinstall the addons by running godotenv addons install and everything will "just work." Additionally, it's easy to see which addons have changed over time and across different branches — just check the git diff for the addons.json file.

Initializing GodotEnv in a Project

GodotEnv needs to tell git to ignore your addons directory so that it can manage addons instead. Additionally, it will place a .editorconfig in your addons directory that will suppress C# code analysis warnings, since C# styles tend to vary drastically.

godotenv addons init

This will add something like the following to your .gitignore file:

# Ignore all addons since they are managed by GodotEnv:
addons/*

# Don't ignore the editorconfig file in the addons directory.
!addons/.editorconfig

The addons init command will also create a .editorconfig in your addons directory with the following contents:

[*.cs]
generated_code = true

Finally, GodotEnv will create an example addons.jsonc file with the following contents to get you started:

// Godot addons configuration file for use with the GodotEnv tool.
// See https://github.com/chickensoft-games/GodotEnv for more info.
// -------------------------------------------------------------------- //
// Note: this is a JSONC file, so you can use comments!
// If using Rider, see https://youtrack.jetbrains.com/issue/RIDER-41716
// for any issues with JSONC.
// -------------------------------------------------------------------- //
{
  "$schema": "https://chickensoft.games/schemas/addons.schema.json",
  // "path": "addons", // default
  // "cache": ".addons", // default
  "addons": {
    "imrp": { // name must match the folder name in the repository
      "url": "https://github.com/MakovWait/improved_resource_picker",
      // "source": "remote", // default
      // "checkout": "main", // default
      "subfolder": "addons/imrp"
    }
  }
}

Installing Addons

GodotEnv will install addons from symlinks, local paths, or remote git url's using the system shell. Please make sure you've configured git in your shell environment to use any desired credentials, since git will be used to clone local and remote repositories.

godotenv addons install

When you run the addon installation command in GodotEnv, it looks in the current working directory of your shell for an addons.json or [addons.jsoncjsonc file. The addons file tells GodotEnv what addons should be installed in a project.

Here's an example addons file that installs 3 addons, each from a different source (remote git repository, local git repository, and symlink).

{
  "path": "addons", // optional — this is the default
  "cache": ".addons", // optional — this is the default
  "addons": {
    "godot_dialogue_manager": {
      "url": "https://github.com/nathanhoad/godot_dialogue_manager.git",
      "source": "remote", // optional — this is the default
      "checkout": "main", // optional — this is the default
      "subfolder": "addons/dialogue_manager" // optional — defaults to "/"
    },
    "my_local_addon_repo": {
      "url": "../my_addons/my_local_addon_repo",
      "source": "local"
    },
    "my_symlinked_addon": {
      "url": "/drive/path/to/addon",
      "source": "symlink"
    }
  }
}

❗️ Each key in the addons dictionary above must be the directory name of the installed addon inside the project addons path. That is, if an addon repository contains its addon contents inside addons/my_addon, the name of the key for the addon in the addons file must be my_addon.

Local Addons

If you want to install an addon from a local path on your machine, your local addon must be a git repository. You can specify the url as a relative or absolute file path.

{
  "addons": {
    "local_addon": {
      "url": "../my_addons/local_addon",
      "checkout": "main",
      "subfolder": "/",
      "source": "local"
    },
    "other_local_addon": {
      "url": "/Users/me/my_addons/other_local_addon",
      "source": "local"
    },
  }
}

Remote Addons

GodotEnv can install addons from remote git repositories. Below is the addon specification for an addon from a remote git repository. The url can be any valid git remote url.

{
  "addons": {
    "remote_addon": {
      "url": "[email protected]:user/remote_addon.git",
      "subfolder": "addons/remote_addon"
    }
  }
}

By default, GodotEnv assumes the addon source is remote, the checkout reference is main, and the subfolder to install is the root / of the repository. If you need to customize any of those fields, you can override the default values:

{
  "addons": {
    "remote_addon": {
      "url": "[email protected]:user/remote_addon.git",
      "source": "remote",
      "checkout": "master",
      "subfolder": "subfolder/inside/repo",
    }
  }
}

Symlink Addons

Finally, GodotEnv can "install" addons using symlinks. Addons installed with symlinks do not need to point to git repositories — instead, GodotEnv will create a folder which "points" to another folder on your file system using symbolic linking.

  "addons": {
    "my_symlink_addon": {
      "url": "/Users/myself/Desktop/folder",
      "source": "symlink"
    },
    "my_second_symlink_addon": {
      "url": "../../some/other/folder",
      "source": "symlink",
      "subfolder": "some_subfolder"
    }
  }

Note: The checkout reference is ignored when using symlinks.

Whenever a symlinked addon is modified, the changes will immediately appear in the project, unlike addons included with git repositories. Additionally, if you change the addon from your game project, it updates the addon source where the symbolic link is pointing.

Using symlinks is a great way to include addons that are still in development across one or more projects.

Addons Configuration

GodotEnv caches local and remote addons in the cache folder, configured above with the cache property in the addons.json file (the default is .addons/, relative to your project). You can safely delete this folder and GodotEnv will recreate it the next time it installs addons. Deleting the cache forces GodotEnv to re-download or copy everything on the next install.

IMPORTANT: Be sure to add the .addons/ cache folder to your .gitignore file!

GodotEnv will install addons into the directory specified by the path key in the addons.json file (which defaults to just addons/).

Addons should be omitted from source control. If you need to work on an addon at the same time you are working on your Godot project, use GodotEnv to symlink the addon. By omitting the addons folder from source control, you are able to effectively treat addons as immutable packages, like NPM does for JavaScript.

Just run godotenv addons install after cloning your project or whenever your addons.json file changes!

Addons for Addons

An addon can itself contain an addons.json file that declares dependencies on other addons. When the addon is cached during addon resolution, GodotEnv checks to see if it also contains an addons.json file. If it does, GodotEnv will add its dependencies to the queue and continue addon resolution. If GodotEnv detects a potential conflict, it will output warnings that explain any potential pitfalls that might occur with the current configuration.

GodotEnv uses a flat dependency graph that is reminiscent of tools like bower. In general, GodotEnv tries to be extremely forgiving and helpful, especially if you try to include addons in incompatible configurations. GodotEnv will display warnings and errors as clearly as possible to help you resolve any potential conflicting scenarios that may arise.

Contribution

If you want to contribute, please check out CONTRIBUTING.md!

While the addons installation logic is well-tested, the Godot version management feature is new and still needs tests. Currently, a GitHub workflow tests it end-to-end. As I have time, I will add more unit tests.


🐣 Made with love by 🐤 Chickensoft — https://chickensoft.games

godotenv's People

Contributors

adrasteondev avatar definitelyokay avatar edassis avatar gariel avatar justinhhorner avatar paulloz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

godotenv's Issues

Some Unit Tests Fail on Windows

Description

While preparing to start work on #12 I found that several unit tests are failing on Windows (tested on two machines).

I've yet to go through all the tests, but I have identified a few fail due to assertions expecting \n but the console output string on Windows will be \r\n.

I'll work through these issues first and then get started on #12

Screenshots

Screenshot 2023-09-29 202723

Failed to start a process with file path 'unzip'

System.ComponentModel.Win32Exception: Failed to start a process with file path 'unzip'. Target file or working directory doesn't exist or the provided credentials are invalid.
    System.ComponentModel.Win32Exception: An error occurred trying to start process 'unzip' with working directory '/root/.config/godotenv/godot/versions'. No such file or directory
      at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec) 
      at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) 
      at CliWrap.Utils.ProcessEx.Start() in /D:\a\CliWrap\CliWrap\CliWrap\Utils\ProcessEx.cs:66
  at CliWrap.Utils.ProcessEx.Start() in /D:\a\CliWrap\CliWrap\CliWrap\Utils\ProcessEx.cs:76
  at CliWrap.Command.ExecuteAsync(CancellationToken cancellationToken) in /D:\a\CliWrap\CliWrap\CliWrap\Command.cs:508
  at Chickensoft.GodotEnv.Common.Utilities.ProcessRunner.Run(String workingDir, String exe, String[] args) in /home/runner/work/GodotEnv/GodotEnv/GodotEnv/src/common/utilities/ProcessRunner.cs:78
  at Chickensoft.GodotEnv.Common.Utilities.Shell.Run(String executable, String[] args) in /home/runner/work/GodotEnv/GodotEnv/GodotEnv/src/common/utilities/Shell.cs:27
  at Chickensoft.GodotEnv.Common.Clients.ZipClientTerminal.ExtractToDirectory(String sourceArchiveFileName, String destinationDirectoryName, IProgress`1 progress, ILog log) in /home/runner/work/GodotEnv/GodotEnv/GodotEnv/src/common/clients/ZipClientTerminal.cs:32
  at Chickensoft.GodotEnv.Features.Godot.Domain.GodotRepository.ExtractGodotInstaller(GodotCompressedArchive archive, ILog log) in /home/runner/work/GodotEnv/GodotEnv/GodotEnv/src/features/godot/domain/GodotRepository.cs:328
  at Chickensoft.GodotEnv.Features.Godot.Commands.GodotInstallCommand.ExecuteAsync(IConsole console) in /home/runner/work/GodotEnv/GodotEnv/GodotEnv/src/features/godot/commands/install/GodotInstallCommand.cs:76
  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

On my Manjaro machine the download of a new godot version doesn't work.
My guess is that the /root access causes problems because its read only.

Ability to version lock addons

While I like the concept of being able to manage addons using just an addons.jsonc file, there doesn't seem to be a way to lock which version of the addons you want to use. In addition GodotEnv grabs the main branch which could potentially be in a broken state compared to a release.

Support Godot 3

There are some discrepancies in the download file names from Godot 3 to 4 that we can resolve to support Godot 3.

System.NullReferenceException When Running `godotenv godot list`

I encountered an error while attempting to list the Godot installations using the godotenv command. Could it be Dropbox?

Here are the specifics:

Command:

godotenv godot list

Error Message:

ERROR
System.NullReferenceException: Object reference not set to an instance of an object.
  at Chickensoft.GodotEnv.Features.Godot.Domain.GodotRepository.<>c.<GetInstallationsList>b__35_0(GodotInstallation i) in /Users/joanna/Dropbox/GameDev/Chickensoft/chicken/GodotEnv/src/features/godot/domain/GodotRepository.cs:415
  ...
  at CliFx.CliApplication.RunAsync(IReadOnlyList`1 commandLineArguments, IReadOnlyDictionary`2 environmentVariables) in /_/CliFx/CliApplication.cs:193

Environment:

  • OS: macOS Sonoma 14.0
  • godotenv Version: 1.0.0
  • .NET Runtime Version: .NET 7

add ability to install export templates

It would be nice if there was a flag -e or --export-templates for godotenv godot install that would also install the relevant export templates on mac/win/linux.

Additionally, you might also need a separate command just to install the export templates (if you hadn't supplied the flag during installation) and probably one to check if they were installed.

Naturally, this would need to work across each of the 3 major OS's, which means installing the export templates to the correct location. Someone had graciously contributed the support for this to https://github.com/chickensoft-games/setup-godot a while back, and I believe I even ported some of the relevant logic for it to GodotEnv, but it will likely need updates.

bug: not finding GodotSharp on macOS (possibly other platforms)

I need to fix this ASAP.

Not finding GodotSharp on macOS (possibly other platforms) when GODOT env var is invoked on command line. Opening up the Godot binary itself from Finder doesn't seem to have that issue.

When making https://github.com/chickensoft-games/setup-godot, the trick was to create and track an additional symlink to the GodotSharp folder included in the Godot app and add it to the system path. GodotEnv almost certainly needs to be doing something like that.

Screen Shot 2023-09-16 at 9 10 49 AM

On my system, the symlink to Godot ends up being /Users/joanna/.config/godotenv/godot/bin.

Instead of adding to the system path, I can probably create another symlink. This is because it is expecting GodotSharp to be based off a value that can be inferred from the current symlink: it's dropping the /bin and concatenating /GodotSharp/Api/Debug to the symlink. So, creating and maintaining a second symlink with the expected path should fix the issue, just like in setup-godot.

Amazing that $GODOT --version works — that's what kept me from noticing this in CI/CD. But actually running godot from CLI does not.

feature: list available godot versions

It would nice to have a way to list the available versions of godot.
Right now, you can only list installed versions. To install a new version, you need to open the NuGet gallery and check the available versions there.

Maybe the "godotenv godot list" command could return the last 5 released versions (along with the currently installed ones)

[FEATURE] Adding .desktop files / Start Menu shortcuts

Hi, I've been looking at a bunch of different version managers but I quite like this one. I was wondering if it would be possible to extract a .desktop file to the relevant location on Linux to include in an application launcher (and/or similar for Windows' Start Menu). I believe for Linux this would be /usr/share/applications/.

It would probably be best to have multiple configurations for this, something like

  • All installed versions show (in a folder?)
  • Only the active version shows
  • No versions show

Avoid spamming the elevation prompt on Windows

Running godotenv godot use <version> or godotenv godot install <version> asks for elevation 5 times in rapid succession. It can become quite annoying. Play with sound, each bell is a full screen elevation prompt:

Code_dE725OMceZ.mp4

We might want to consider, on Windows, to elevate the entire tool process at the start of the command if needed?

On a semi-related note, I don't believe the UACHelper library is needed. The following patch would work seamlessly AFAIK.

-    var process = UACHelper.UACHelper.StartElevated(new ProcessStartInfo() {
-      FileName = exe,
-      Arguments = args,
-      UseShellExecute = true,
-      CreateNoWindow = false
-    });
+    Process process = new() {
+      StartInfo = new() {
+        FileName = exe,
+        Arguments = args,
+        UseShellExecute = true,
+        Verb = "runas",
+        CreateNoWindow = false,
+      }
+    };

CLI Throws Error When Using Same Remote Twice

Hey there. I really like this addon management CLI its super nice!
But I encountered a problem when I have 2 addons that come from the same git repository.
I use different subfolders for different tools but like to have them all in one repository.
So I used following addons.json file.
addons.log

And when running the chicken addon install command it throws following error:
ERROR System.ArgumentException: An item with the same key has already been added. Key: https://gitlab.com/project/godottools.git at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) at Chickensoft.Chicken.AddonRepo.LoadCache(Config config) in \Users\joanna\Dropbox\GameDev\Chickensoft\chicken\Chicken\src\addon\AddonRepo.cs:50 at Chickensoft.Chicken.AddonManager.InstallAddons(String projectPath, Nullable`1 maxDepth) in \Users\joanna\Dropbox\GameDev\Chickensoft\chicken\Chicken\src\addon\AddonManager.cs:37 at Chickensoft.Chicken.InstallCommand.ExecuteAsync(IConsole console) in \Users\joanna\Dropbox\GameDev\Chickensoft\chicken\Chicken\src\command s\AddonInstallCommand.cs:41 at CliFx.CliApplication.RunAsync(ApplicationSchema applicationSchema, CommandInput commandInput) in D:\a\CliFx\CliFx\CliFx\CliApplication.cs:147 at CliFx.CliApplication.RunAsync(IReadOnlyList`1 commandLineArguments, IReadOnlyDictionary`2 environmentVariables) in D:\a\CliFx\CliFx\CliFx\CliApplication.cs:191

It seems to be fine if I delete the .addons and addon folder but this seems more like a workaround.

godotenv godot list gives NullReferenceException

Using GodotEnv v1.5.0 on macOS 14.1.1, I ran into an issue that the version list now always returns a NullReferenceException. Here's the terminal output that preceded it:

adriaan@Adriaans-MacBook ~ % godotenv godot list
4.2.0-rc.1 dotnet *
adriaan@Adriaans-MacBook ~ % godotenv godot install 4.2.0-rc2
🍏 Running on macOS
🤖 Godot v4.2.0-rc2
🍯 Parsed version: Major(4).Minor(2).Patch(0)-Label(rc2)
😁 Using Godot with .NET
⬇ Downloading Godot...
🌏 Godot download url: https://github.com/godotengine/godot-builds/releases/download/4.2-rc2/Godot_v4.2-rc2_mono_macos.universal.zip
🧼 Cleaning up...
✨ All clean!
🗄 Cache path: /Users/adriaan/.config/godotenv/godot/cache/godot_dotnet_4_2_0_rc2
📄 Cache filename: godot_dotnet_4_2_0_rc2.zip
💾 Compressed installer path: /Users/adriaan/.config/godotenv/godot/cache/godot_dotnet_4_2_0_rc2/godot_dotnet_4_2_0_rc2.zip
🚀 Downloaded Godot: 100%% at 27,51 MB/s      

✅ Godot successfully downloaded.

🗜 Extracted 199 / 199 files in /Users/adriaan/.config/godotenv/godot/cache/godot_dotnet_4_2_0_rc2/godot_dotnet_4_2_0_rc2.zip.
🚀 Extracting Godot installation files: 100%
🗜 Successfully extracted Godot to:

  /Users/adriaan/.config/godotenv/godot/versions/godot_dotnet_4_2_0_rc2


🔗 Linking GodotSharp /Users/adriaan/.config/godotenv/godot/GodotSharp -> /Users/adriaan/.config/godotenv/godot/versions/godot_dotnet_4_2_0_rc2/Godot_mono.app/Contents/Resources/GodotSharp
✅ Godot symlink updated.

/Users/adriaan/.config/godotenv/godot/bin -> /Users/adriaan/.config/godotenv/godot/versions/godot_dotnet_4_2_0_rc2/Godot_mono.app/Contents/MacOS/Godot

Godot symlink path:

/Users/adriaan/.config/godotenv/godot/bin

📝 Adding or updating the GODOT environment variable.

Successfully updated the GODOT environment variable.


You may need to restart your shell or run the following 
to get the updated environment variable value.

    source ~/.zshrc

/Users/adriaan/.config/godotenv/godot/bin
adriaan@Adriaans-MacBook ~ % godotenv godot list             
ERROR
System.NullReferenceException: Object reference not set to an instance of an object.
  at Chickensoft.GodotEnv.Features.Godot.Domain.GodotRepository.<>c.<GetInstallationsList>b__39_0(GodotInstallation i) in /home/runner/work/GodotEnv/GodotEnv/GodotEnv/src/features/godot/domain/GodotRepository.cs:521
  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:493
  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

Issue persists even after restarting the terminal and running godotenv godot cache clear. Any ideas how to fix this or further debug this?

[FEATURE] Support for other shells

Currently, the program aliases the Godot path in the .bashrc file on Linux and .zshrc on Mac, but not everyone uses Bash on Linux (for example, I use ZSH). Is it possible to instead specify the output file in the godotenv godot env setup command or similar?

GodotEnv generating Invalid Symbolic Link on Windows for non dotnet installations

I'm winding up with an invalid symbolic link after calling godotenv godot use 4.1.2 -n on Windows with a non-dotnet installation of Godot 4.1.2.

Steps to Reproduce:

  1. Install non-dotnet godot 4.1.2 godotenv godot install 4.1.2 --no-dotnet.
  2. Activate it for use godotenv godot use 4.1.2 -n.

Expected:
Running %godot% from a cmd terminal should launch the desired non-dotnet version of Godot.

Actual:
Running %godot% from a cmd terminal yields the following error:

'C:\Users\...\AppData\Roaming\godotenv\godot\bin' is not recognized as an internal or external command, operable program or batch file.

It appears that the generated symlink expects a subdirectory to be present:
versions\godot_4_1_2\Godot_v4.1.2-stable_win64.exe\Godot_v4.1.2-stable_win64.exe

When in reality the path to the binaries is:
versions\godot_4_1_2\Godot_v4.1.2-stable_win64.exe

.Net enabled builds do use a subfolder for the binaries directory and work as expected.

Reinstalling remote addon fails on Windows

After installing a remote addon, running chicken addons install again will fail with an error like:

Attempting to install "godot_dialogue_manager."

  Installing: Addon "godot_dialogue_manager" from `C:\proj\MyGame\addons.json` at `addons/dialogue_manager/` on branch `main` of `https://github.com/nathanhoad/godot_dialogue_manager`
Failed to install "godot_dialogue_manager": Access to the path 'c08d5210ed51de792f91538f9befb696e51faa' is denied.

Example addons.json

{
  "addons": {
    "godot_dialogue_manager": {
      "url": "https://github.com/nathanhoad/godot_dialogue_manager",
      "subfolder": "addons/dialogue_manager"
    }
  }
}

Various first time install issues

Hello!

I just setup a new Mac (macOS 14.1.1) and in setting up everything necessary for Godot, I wanted to check out godotenv as well. I came across various first time install issues for which the docs didn't provide any guidance or requirements.

First, I ran into this:

godotenv --help
You must install or update .NET to run this application.

App: /Users/adriaan/.dotnet/tools/godotenv
Architecture: arm64
Framework: 'Microsoft.NETCore.App', version '6.0.0' (arm64)
.NET location: /usr/local/share/dotnet

The following frameworks were found:
  8.0.0 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Learn more:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=arm64&rid=osx-arm64&os=osx.14

Then, after installing dotnet 6.0.0 on top of the newer 8.0.0 already on my Mac (which seems silly, but ok), I ran into the following:

godotenv godot install 4.2.0-rc.1
🍏 Running on macOS
🤖 Godot v4.2.0-rc.1
🍯 Parsed version: Major(4).Minor(2).Patch(0)-Label(rc.1)
😁 Using Godot with .NET
⬇ Downloading Godot...
🌏 Godot download url: https://github.com/godotengine/godot-builds/releases/download/4.2-rc1/Godot_v4.2-rc1_mono_macos.universal.zip
🧼 Cleaning up...
✨ All clean!
🗄 Cache path: godotenv/godot/cache/godot_dotnet_4_2_0_rc_1
📄 Cache filename: godot_dotnet_4_2_0_rc_1.zip
💾 Compressed installer path: godotenv/godot/cache/godot_dotnet_4_2_0_rc_1/godot_dotnet_4_2_0_rc_1.zip
🚀 Downloaded Godot: 100%% at 41,76 MB/s      

✅ Godot successfully downloaded.

ERROR
System.InvalidOperationException: Failed to run `unzip` in `godotenv/godot/versions` with args `-l godotenv/godot/cache/godot_dotnet_4_2_0_rc_1/godot_dotnet_4_2_0_rc_1.zip`. Received exit code 9.
  at Chickensoft.GodotEnv.Common.Utilities.Shell.Run(String executable, String[] args) in /home/runner/work/GodotEnv/GodotEnv/GodotEnv/src/common/utilities/Shell.cs:29
  at Chickensoft.GodotEnv.Common.Clients.ZipClientTerminal.ExtractToDirectory(String sourceArchiveFileName, String destinationDirectoryName, IProgress`1 progress, ILog log) in /home/runner/work/GodotEnv/GodotEnv/GodotEnv/src/common/clients/ZipClientTerminal.cs:32
  at Chickensoft.GodotEnv.Features.Godot.Domain.GodotRepository.ExtractGodotInstaller(GodotCompressedArchive archive, ILog log) in /home/runner/work/GodotEnv/GodotEnv/GodotEnv/src/features/godot/domain/GodotRepository.cs:319
  at Chickensoft.GodotEnv.Features.Godot.Commands.GodotInstallCommand.ExecuteAsync(IConsole console) in /home/runner/work/GodotEnv/GodotEnv/GodotEnv/src/features/godot/commands/install/GodotInstallCommand.cs:74
  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

I haven't figured out yet how to get around this one yet, so any help would be appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.