Closed Danielv123 closed 6 years ago
I'm going to be very honest with you. The code for getting mods from a save file isn't actually mine. I found it somewhere and it worked (I forget where I found it), but it might be outdated and incompatible with 0.15. So I have no idea why it's not working and how to fix it. I'll look for a solution when I have got the time to do so.
JARG had a lot at the error and said it looked like it was unzipped and then just returned the data as a string, which would explain why definitions from data.lua has become muddled in there.
Might help you debug.
Fixed in #3
The number of bytes between mods changed in Factorio version 0.15 from 4 to 8. I made a pull request correcting this and also corrected a little offset bug when reading the name, so it should no longer be needed to trim the name or remove non-ASCII characters.
BTW you might have found the original the same place i did https://forums.factorio.com/viewtopic.php?f=69&t=35644
I merged your pull request, thanks a lot! I did indeed find the code from AlyxDeLunar. I didn't test anything or make any changes since 0.15 released, so I didn't know that it didn't work anymore.
Sounds like we need unit tests, but good job on fixing this one 👍
I did initially make unit tests, but they don't work very well, because of timeouts when it takes too long to download a mod.
Using mocha, you can extend the timeout for specific tests. See for example line 104 of https://github.com/Danielv123/factorioClusterio/blob/f3bb8c58e56865c7b8643cd0d6454975d6c092ac/lib/fileOps.spec.js
or line 39 of https://github.com/Danielv123/factorioClusterio/blob/b847b1a934a73186b6ca455bd65f09f9c779af1c/master.spec.js
Thanks! That's really useful.
Using the latest package version on NPM (0.1.28) I still get the same error as when I created this issue. This is on a map generated in 0.15.37.
Should this issue be reopened?
The last pull request was merged 1 month ago, but the last time I updated the package was 2 months ago. I might have forgotten to update the package.
https://pastebin.com/SHx2JJpc
The code used: