Save and load game version for fake KSP2 instances #3986
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problems
Two problems came up during KSP-CKAN/KSP2-NetKAN#125:
ckan show --with-versions
lists multiple copies of the same version of a mod when the meta tester runs itInitially I thought the former was caused by how the meta tester's Python code handles game version build numbers, but KSP-CKAN/xKAN-meta_testing#97 didn't fix it.
Causes
KerbalSpaceProgram2.DetectVersion
can retrieve. That function usesFileVersionInfo.GetVersionInfo(path).ProductVersion
to examine the game's executable, and we can't generate an executable on the fly. The game version we pass on the command line is saved to areadme.txt
file but otherwise ignored.Registry.AvailableByIdentifier
Changes
KSP_x64.exe
as an empty file, we save the game version in itFileVersionInfo.GetVersionInfo(path).ProductVersion
, we fall back to loading the text of the file as per the above pointRegistry.AvailableByIdentifier
filters out duplicates