[Feedback/Bug] The problem with "Game backup": Unsanitized Foldernames
Hello there.

I don't know, if this is the right board for it, but I'll proceed anyway.

If you are one of those, which like to store their games offline on an external drive or server, this may contain some info you need to know. Steam has a "minor" problem with that, even if the function itself or writing and reading works as intended.

Issue 1:

The backup function tries to take the name of the game in ANSI and create a folder using it.

If the name of a game consists of Unicode AND latin letters, the Unicode characters get omitted.

If the name of a game consists ENTIRELY of Unicode, a folder isn't created and the depotfiles are just slapped into the target folder instead.

This game is the prime example of that:
https://steamhost.cn/app/2389120

The gamename is "战姬军团" and causes this behavior.


Issue 2:

Some characters like * / \ < > : | and ? are invalid to NTFS. Some games have those as part of their name.

If you now back a game up, which has one of those characters as part of their name, you can endup with a folder including invalid NTFS characters. The ":" is already omitted, though.


Issue 3:

Windows doesn't like it, when you create folders ending with a dot (or period) .

I figured this out on "R.E.P.O."

If you now create a backup of that game, that folder will become undeletable the normal way and you have to through the "back" of the system to delete it, which normal people don't know how to. And yes, I had to google how to do that myself to get rid of the folder.

Seems to work fine on Linux.


Solution:

Step 1: The function for creating a folder name from the Game name should use Unicode when passed to create a folder. If the function uses Win32 API, consider the W Variants, not A (ANSI).

Step 2: After the folder name was derived from the gamename using Unicode, any invalid character to NTFS must be removed from the string prior creation.

Step 3: If the derived folder name string ends in a dot, that dot must be removed prior creation. Removing a dot at the start of a name may interfere with Linux.

Step 4: Finally, create a folder with a sanitized "game name" with Unicode API.

Please fix those.