Skip to content

Don't traverse the entire HOME directory to find wads

Hanicef requested to merge Hanicef/SRB2:avoid-traversing-home into next

So, I ran into a pretty surprising situation on SRB2 yesterday after installing Debian's own steam package instead of using the one supplied by Valve. In a nutshell, what Debian's install does differently is that it isolates the entire steam install inside the user's home directory instead of installing it globally, resulting in a pretty large file tree in the home directory. After trying to start up SRB2, though, it resulted in the game freezing on startup, and after stepping through the process with a debugger, I noticed that it was actually traversing the entire steam install directory. Digging deeper into this, it turns out that SRB2 is always traversing the entire home directory, something that i don't really find a realistic approach to file discovery.

For this reason, I'm changing the WAD finding logic to only traverse ~/.srb2, which is where SRB2 should normally be installed. This works much more like you'd expect SRB2 to load files, and should not only greatly reduce load times since it only searches only a fraction of what it used to do, but it should also prevent SRB2 from loading the wrong directory in case you have another SRB2 data directory besides ~/.srb2 (which you can already override by either specifying SRB2WADDIR or starting the game with -home).

Merge request reports