Closed HebaruSan closed 6 years ago
Merged into a branch, will test first
Did you consider, instead of adding all this, to modify it to only look a .version files in the same directory it is in? That is the original intention of it
I assume that would break existing usages. E.g.:
And it doesn't look like that's the original intention:
This plugin checks inside its current directory and all contained directories for version files.
- If your add-on contains multiple version files, place it at the lowest directory level which will cover all the version files, but do not place it in GameData.
The changelog doesn't mention this being added later; looks like "all contained directories" was part of the intention all along.
I see, you are correct.
I've been testing this. This works for the DLL, but it still shows multiple entries if there are multiple copies of the .version file. Still a great improvement
Motivation
https://github.com/KSP-CKAN/NetKAN/issues/1455#issuecomment-217134778
This pull request aims to fix that.
Cause
The scenario described above can be generalized to any situation in which two copies of MiniAVC.dll are located in directories which are in an ancestor/descendant relationship. E.g.:
Or even something like:
In those cases, this code will find version files in the nested subfolder multiple times and add them to the list of addons to check:
https://github.com/linuxgurugamer/KSPAddonVersionChecker/blob/0caed8a8baffbd78885d1f8a701a803b2ba20463/MiniAVC/AddonLibrary.cs#L90-L100
Later this results in multiple popups if there are incompatibilities or updates.
Changes
Now we build a temporary
Dictionary
that tracks version files and their associated settings. If we find the same version file more than once, we don't add it multiple times; instead we compare the associated settings files and choose the one that is closest to that version file. Once we've checked all the files, we collapse theDictionary
to a list ofAddons
, as before.This is what I was trying to compile on the mod adoption tutorial thread. I have not been able to get the build working, so there may be syntax errors here; just let me know and I'll fix them.