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
328 stars 17 forks source link

Failed to copy addon #70

Closed RoboSkyrat closed 2 months ago

RoboSkyrat commented 3 months ago

When running godotenv addons install in a brand new chickengame project with the following addons.jsonc I receive a failed to copy exception.

Repo steps

run dotnet new chickengame --name "ReproTest" & cd into it

run godotenv addons init

Modify addons.jsonc to be

// 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": {
    "steam-mutliplayer-peer": {
      "url": "https://github.com/expressobits/steam-multiplayer-peer",
      "checkout": "addon",
      "subfolder": "addons/steam-mutliplayer-peer"
    }
  }
}

run godotenv addons install

Result

Discovered "steam-mutliplayer-peer."

  Resolved: Addon "steam-mutliplayer-peer" from `addons.jsonc` at `addons/steam-mutliplayer-peer/` on branch `addon` of `https://github.com/expressobits/steam-multiplayer-peer`

An error was encountered while attempting to install addons.

System.IO.IOException: Failed to copy `S:\projects\ReproTest\.addons\steam-mutliplayer-peer\addons/steam-mutliplayer-peer\` to `S:\projects\ReproTest\addons\steam-mutliplayer-peer\`
   at Chickensoft.GodotEnv.Common.Clients.FileClient.CopyBulk(IShell shell, String source, String destination) in /home/runner/work/GodotEnv/GodotEnv/GodotEnv/src/common/clients/FileClient.cs:line 496
   at Chickensoft.GodotEnv.Features.Addons.Domain.AddonsRepository.InstallAddonFromCache(IAddon addon, String cacheName) in /home/runner/work/GodotEnv/GodotEnv/GodotEnv/src/features/addons/domain/AddonsRepository.cs:line 215
   at Chickensoft.GodotEnv.Features.Addons.Commands.AddonsLogic.State.Unresolved.On(Install input) in /home/runner/work/GodotEnv/GodotEnv/GodotEnv/src/features/addons/commands/install/AddonsLogic.cs:line 141      
   at Chickensoft.LogicBlocks.LogicBlockAsync`1.RunSafe(Func`1 handler, TState fallback)

An error occurred while installing addons:
Failed to copy `S:\projects\ReproTest\.addons\steam-mutliplayer-peer\addons/steam-mutliplayer-peer\` to `S:\projects\ReproTest\addons\steam-mutliplayer-peer\`

Could not resolve addons. Please address any errors and try again.

Manually copying the addons/steam-multiplayer-peer directory into addons from .addons works just fine, godotenv is just unable to do it by itself. All other addons work fine including gdsteam (another gdextension)

jolexxa commented 3 months ago

@RoboSkyrat it seems you might be on Windows — can you try installing it from an elevated terminal and see if it still fails? Some files or file types might have permissions errors.

RoboSkyrat commented 3 months ago

I just tried it again, I receive the same error within an administrator terminal. Digging into the source and running robocopy myself it runs just fine and returns the correct exit code ( 1 or 0 depending on I've run it previously)

RoboSkyrat commented 2 months ago

I have figured it out, after taking a step back and looking over my addons.jsonc file I realized that I had set subfolder incorrectly. My bad.

jolexxa commented 2 months ago

@RoboSkyrat okay, glad you figured it out and glad it's nothing wrong! 🤠