SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

2M Downloads

ModBuildConfig does not clear old installs of bundled content packs

lisyce opened this issue ยท 1 comments

commented

Describe the bug
The bug: When a content pack is bundled with a mod and copied to the Mods folder on build, now-deleted files from older builds may remain in the mod's folder. This can result in some clutter and uncertainty that the new build has been properly copied over.

Environment
Windows 11 computer, using Rider as my development environment. The default ModBuildConfig setting of copying the build to the Mods folder is on.

To Reproduce

  1. Create any C# SMAPI mod using the ModBuildConfig Nuget package. Create a folder in the mod's directory that contains a content pack (e.g. a Content Patcher pack). Include a json file named somefile.json in that content pack. It can have an empty object as the file contents.
  2. In the .csproj file, use the ContentPacks field to bundle the content pack with the mod on build.
<ItemGroup>
  <ContentPacks Include="My Content Pack Folder Name" Version="$(Version)" />
</ItemGroup>
  1. Build the mod.
  2. Verify that the content pack including somefile.json has been bundled with the release and copied to the Mods folder.
  3. Delete somefile.json and rebuild the mod.
  4. Go to the Mods folder and notice that somefile.json is still present, despite it no longer being part of the content pack.
commented

Hi! The mod build package can't safely delete files in the Mods folder, since it doesn't know why a given file exists. It could have been generated by the mod (e.g. that's commonly done for config.json), another mod, a mod manager, etc. Usually that's not an issue, since unknown files in a mod folder are ignored.

If you really do need to delete the file, unfortunately you'll need to do it manually (or delete and redeploy the mod).