Skip to content

[Fix] Account for spaces in GOG game save paths on Windows #3783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

ghoste07
Copy link
Contributor

The way arguments are passed to PowerShell already handles spaces in the path and the additional quotation marks added by getShellPath() causes the path to be truncated at the first space (if present).

For example, 'C:\Users\User\Documents\The Witcher 3' gets interpreted as 'C:\Users\User\Documents\The'.

Using .replaceAll() should be safe since files/folders in Windows can't contain quotes anyway.

(Apologies if there's a better way to do this - Most of my experience is in bash and this is the first I've looked at the heroic codebase)


Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

Removes quotation marks from GOG game save paths for cloud sync.

The way we pass arguments to PowerShell already handles spaces in the path and the quotation marks added by getShellPath() causes paths to get truncated at the first space if they contain any.
@flavioislima
Copy link
Member

flavioislima commented May 26, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@ghoste07
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

Copy link
Collaborator

@CommandMC CommandMC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution

This change is generally fine, but it'd be great if this function wouldn't rely on knowing that getShellPath adds quotes around paths. Given we don't do this (and don't handle this properly) in other places either, the best course of action might be changing getShellPath to just not add quotes in the first place

@ghoste07
Copy link
Contributor Author

ghoste07 commented Jun 9, 2024

the best course of action might be changing getShellPath to just not add quotes in the first place

I agree, that's better. I've updated the PR for that. I didn't notice any regressions in my limited testing.

@CommandMC
Copy link
Collaborator

Well, I'd consider regressions rather unlikely here, considering this is the only function using getShellPath (not sure where everything else went, could've sworn this was used elsewhere)

@CommandMC CommandMC merged commit 0c8083b into Heroic-Games-Launcher:main Jun 13, 2024
9 checks passed
@Heroic-Games-Launcher Heroic-Games-Launcher locked and limited conversation to collaborators Jun 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants