Closed ghost closed 5 years ago
The file name is part of the hash. So if you rename the file the cache is invalidated.
The thing is, I didn't rename the file. If the file name contains a space (probably only in exactly this position), MM thinks it's a different file and invalidates its cache. To work around this, I then renamed it, and the issue went away.
oh, so as long as the file has a space then the cache never works ?
Exactly. For every launch of KSP, the log always shows these lines about an "added" and a "deleted" file, when nothing has actually changed.
I was having the same problem, took me a couple of hours of going through the files and finding no problems until I read this issue. Turns out I had a space in the filenames just before the .cfg extension
[LOG 00:56:16.483] [ModuleManager] Checking Cache
[LOG 00:56:16.844] [ModuleManager] SHA generated in 0.354s
[LOG 00:56:16.844] [ModuleManager] SHA = DE-E4-38-86-00-D2-A7-5C-C0-46-41-EF-05-A2-13-D6-09-0A-1F-0D-63-51-28-E5-2E-D1-DB-52-20-22-A0-6F
[LOG 00:56:16.884] [ModuleManager] Changes :
Added : Kerbalism/Support/USI/USI_FTT .cfg
Added : Kerbalism/Support/USI/USI_NukeStorage .cfg
Deleted : Kerbalism/Support/USI/USI_FTT.cfg
Deleted : Kerbalism/Support/USI/USI_NukeStorage.cfg
[LOG 00:56:16.884] [ModuleManager] Cache SHA = DE-E4-38-86-00-D2-A7-5C-C0-46-41-EF-05-A2-13-D6-09-0A-1F-0D-63-51-28-E5-2E-D1-DB-52-20-22-A0-6F
[LOG 00:56:16.884] [ModuleManager] useCache = False
[LOG 00:56:16.888] [ModuleManager] Pre patch init
[LOG 00:56:17.189] [ModuleManager] compiling list of loaded mods...
KSP does some weird stuff when parsing filenames before ModuleManager even starts. I suspect that’s involved somehow.
Oh duh, because MM only stores the url without the extension and KSP will strip any whitespace from the end of the line when loading the ConfigNode
So it's really only if there's a space right before the extension that this will break. Still, there might be ways to handle it
Tacked the file extension on so that the space at the end of the filename won't be treated as trailing whitespace
Looks like a space character in the file name prevents ModuleManager from properly applying its cache, even though the hash is clearly unchanged:
Simply renaming the file manually allows MM to use its cache again.