mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-09 17:52:08 -10:00
When running a mod on non-windows, that isn't packed into VP files, the mod can break when loading. On non-windows filesystems, the file order isn't guaranteed to be alphabetical (but it is on Windows). As a result, we load tables in an effectively random order. Lots of mods rely on the filesystem ordering to e.g. implement a very loose dependency system for their lua scripts. Referenced on the forum here: https://www.hard-light.net/forums/index.php?topic=95750.msg1885275#msg1885275 Here's a log from Solaris failing to run: https://fsnebula.org/log/5d7b4414cb0d332b466b5ee2#True-138 Instead, always sort filesystem listing by name *before* applying the provided sort order. I've built a few different versions of this patch, and like this one the best. The other ones I tried: 1. Adding a `CF_SORT_REVERSE_NAME` and using it everywhere that `CF_SORT_REVERSE` is used, and replacing all uses of `CF_SORT_NONE` with `CF_SORT_NAME`. I didn't like this as it was a much larger diff. 2. Adding a `CF_SORT_REVERSE_NAME` to the `scripting.cpp` call for loading tables. I didn't like this one because this bug can in theory impact non scripting tables. Here's a log from Solaris working with the new build: https://fsnebula.org/log/5d7b4f37cb0d332b3d6b5ed3#True-138 While it might be a reasonable enhancement in the future to build a proper dependency system for lua scripts and tables, this is a much smaller and easier change, and doesn't require any work from modders.