Crash on Windows if game name ends in a space

Issue: Game crashes during new game load if the specified game name ends in a space.
Crash (y/n): y
Platform (Windows/Mac/Linux): Issue only occurs on Windows.
Description: When creating a directory to store saved games, we try to create a folder with a name matching the game name specified by the user.

Windows helpfully (and silently) removes trailing whitespace from directory names.

The upshot of all this is that if we create a game named "My Game " (with a trailing space), on Windows we end up creating a folder named “My Game” (no trailing space) when we tried to create "My Game ", and then when we try to create a saved game file “My Game \initial_state”, the folder we tried to save into doesn’t exist. As a result, the game throws an assertion because the save failed, because a folder we expected to exist doesn’t exist.

This problem does not occur on OSX or Linux, both of which typically permit trailing spaces on directory names.

With all that said, trailing whitespace in a game name is almost assuredly an accident, and we should trim them ourselves, anyway.

Credit for this find goes to @yxxxx2003; this is the sort of bug find which gets people to buy you drinks. :beer:

(True story: While working QA at Maxis many lifetimes ago, I found a bug in a game that was days from shipping, in which naming your in-game character * had the unintended side-effect of silently deleting all your saved games. I was a hero, that day. Come to think of it, I’d better check to see what MT2 does if you name your game *. I’m pretty sure it should be okay, but… I’d better check!)