Skip to content

add a .gdignore when validating addons cache#207

Open
WahahaYes wants to merge 3 commits intochickensoft-games:mainfrom
WahahaYes:bugfix/ignore_addons_cache
Open

add a .gdignore when validating addons cache#207
WahahaYes wants to merge 3 commits intochickensoft-games:mainfrom
WahahaYes:bugfix/ignore_addons_cache

Conversation

@WahahaYes
Copy link
Copy Markdown

Related to #200 , I had an issue where Godot was trying to parse files in .addons and seeing duplicate classes to what is in addons. Most users don't have this problem but including a .gdignore shouldn't have any negative effect.

@WahahaYes
Copy link
Copy Markdown
Author

I did not expect this to introduce build issues. I’ll take a look at you all’s test structure and see what’s conflicting

@wlsnmrk
Copy link
Copy Markdown
Contributor

wlsnmrk commented Jan 18, 2026

Hi, thanks! There's no IFileClient.WriteAllText() method. You might use IFileClient.CreateFile() instead (see definition here).

@WahahaYes WahahaYes marked this pull request as draft January 18, 2026 20:55
@WahahaYes
Copy link
Copy Markdown
Author

Whoops! I obviously didn’t run tests. I’ll fix this next time I’m sat down at my laptop and learn how to test locally. I’m not familiar with dotnet

@WahahaYes WahahaYes marked this pull request as ready for review January 19, 2026 22:30
@jolexxa
Copy link
Copy Markdown
Member

jolexxa commented Jan 21, 2026

The test probably passes already, but for clarity we should likely mock and test the added behavior of EnsureCacheAndAddonsDirectoriesExists() in AddonsRepoTest:

repo.EnsureCacheAndAddonsDirectoriesExists();

@WahahaYes
Copy link
Copy Markdown
Author

Hi @wlsnmrk @jolexxa , sorry it took me a long time to circle back to this, but added mock behavior here:

  [Fact]
  public void EnsuresExistsCreatesCacheDir()
  {
    var subject = BuildSubject();
    var repo = subject.Repo;
    var client = subject.Client;
    client.Setup(c => c.DirectoryExists(CACHE_DIR)).Returns(false);
    client.Setup(c => c.Combine(CACHE_DIR, ".gdignore")).Returns("/.addons/.gdignore");
    client.Setup(c => c.CreateFile("/.addons/.gdignore", ""));
    repo.EnsureCacheAndAddonsDirectoriesExists();
    client.VerifyAll();
  }

When I run dotnet test I see

Passed!  - Failed:     0, Passed:   405, Skipped:     1, Total:   406, Duration: 3 s - Chickensoft.GodotEnv.Tests.dll (net8.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants