sharkwouter / minigalaxy

A simple GOG client for Linux
https://sharkwouter.github.io/minigalaxy/
GNU General Public License v3.0
1.11k stars 71 forks source link

Invalid characters in wine installation path #165

Closed egladman closed 4 years ago

egladman commented 4 years ago

First of all I want to say thanks for all the hardwork. minigalaxy is great.

Steps to Reproduce

  1. Download Ultima IV: Quest of the Avatar (I think GoG was giving this out for free at some point)

  2. Once downloaded the installer launches (via wine) with the following: Screenshot from 2020-07-26 22-38-09

Click 'OK'

  1. Window pops up with error: Path contains invalid characters(s):: Please change installation path in Options.

Screenshot from 2020-07-26 22-38-40

Click Options

  1. The offending characters are : and . Screenshot from 2020-07-26 22-39-08

  2. Removing the invalid characters from the installation path. Screenshot from 2020-07-26 22-52-06 allows the game to successfully install.

Accept EULA, and click Install

  1. The game has now been successfully installed. Screenshot from 2020-07-26 22-54-27

Click Launch

  1. The game will immediately crash. This The crash might be a by product of running dosbox on top of wine (if so this issue probably is outside the scope of this project), but I presume minigalaxy is still referencing the old installation path: Z:\home\eli\GOG GamesUltima™ 4: Quest of the Avatar`

I came to this conclusion after manually launching the game from minigalaxy: Screenshot from 2020-07-26 23-00-39

My Thoughts

I may very well be approaching the problem from the wrong direction, but here are my thoughts nonetheless. Linux can handle pretty much any (for a lack of a better term) exotic character. Windows cannot. I think it would make sense to sanitize game titles to remove exotic characters from the ~/GOG Games install path.

egladman commented 4 years ago

looks like #150 is related

sharkwouter commented 4 years ago

Thanks for the really detailed bug report, this is amazing. I think #163 is planned to resolve this in the future, but otherwise I hope to look into it somewhere next week.

egladman commented 4 years ago

Haha - Thanks. I'm happy to see someone working on it already :) I'm going to read through the PR tonight

egladman commented 4 years ago

Yep, the changes in #163 should fix my problem.

For reference L54 in minigalaxy/ui/gametile.py was changed from:

self.download_path = os.path.join(self.download_dir, self.game.name)

to

self.download_path = os.path.join(self.download_dir, self.game.get_install_directory_name())

I didn't do any rigorous testing, but it works.

>>> import re
>>> re.sub('[^A-Za-z0-9 ]+', '', "FooBar™ Baz : qux")
'FooBar Baz  qux'
sharkwouter commented 4 years ago

This should now be solved on master

michel-slm commented 4 years ago

This affected "Spycraft: The Great Game" as well, and I can confirm that the GOG installer now installs it to "Spycraft The Great Game" without complaining about invalid characters.

The game still doesn't run (same problem I had before the patch when I tried to fix the desktop file by hand), but this is similar to what @egladman noticed - Spycraft is also shipped by GOG as a Windows game but it just bundles DOSBOX. I wonder if Minigalaxy can detect such game and invoke DOSBOX on its own? Anyway, that's an unrelated matter.

Related to the patch though - I notice that my installation of "Sid Meier's Alpha Centauri" is no longer detected. It has some odd characters that was fine for Windows, but now get stripped: "Sid Meier's Alpha Centauri™ Planetary Pack"

egladman commented 4 years ago

Sorry, I sorta dropped off the face of the earth this past month. I'll pull down the latest changes and test this weekend.

kibun1 commented 4 years ago

There is an entry named "slug" in the GOG API for each game. It doesn't contain special characters, spaces, and whatnot, so maybe we should use that for the installation paths... It can be found here: https://gogapidocs.readthedocs.io/en/latest/listing.html

sharkwouter commented 4 years ago

@kibun1 does this also show in the API request which returns the game list? Then it might be interesting

kibun1 commented 4 years ago

It's present in the API request responses in the get_library() and in the get_info(game) methods of the api class.

sharkwouter commented 4 years ago

This will be fixed in the next release.

LeXofLeviafan commented 2 years ago

Curiously enough, this also happens in 1.0.2 with Crusaders of Might and Magic; in its case, the problem was with… the . in .cache/ (and yes, it's the only game that had a problem with that folder this also happened with Rage of Mages 2, Red Faction and Nox).

I ended up making a symlink to the extraction folder and using it as the install path to work around the issue.