Skip to content
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

Fix Remove forward slash from desktop filename (Shenzhen I/O) #599

Merged
merged 1 commit into from
May 16, 2024
Merged

Fix Remove forward slash from desktop filename (Shenzhen I/O) #599

merged 1 commit into from
May 16, 2024

Conversation

slowsage
Copy link
Contributor

Description

Installing Shenzhen I/O throws the following error:

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/minigalaxy/installer.py", line 72, in install_game
    error_message = create_applications_file(game)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/minigalaxy/installer.py", line 271, in create_applications_file
    os.remove(path_to_shortcut)
FileNotFoundError: [Errno 2] No such file or directory: '/home/USERNAME/.local/share/applications/SHENZHEN I/O.desktop'

/ is not a valid character for a filename in linux. This PR removes all / from the filename part of the path.

Checklist

  • CHANGELOG.md was updated (format: - Change made (thanks to github_username))

Copy link
Owner

@sharkwouter sharkwouter left a comment

Choose a reason for hiding this comment

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

Thanks for this PR, that's a good find!

I did find one issue with this change. Could you add the same change to the uninstall_game function? There the desktop file is removed.

@slowsage slowsage requested a review from sharkwouter May 9, 2024 03:30
@slowsage
Copy link
Contributor Author

slowsage commented May 9, 2024

Can also add a one line helper function _sanitize_filename that is reused if thats cleaner. Not sure what you prefer.

@sharkwouter
Copy link
Owner

If you want to use a sanitize method, I would suggest you do the following:

@slowsage
Copy link
Contributor Author

__strip_string excludes slashes already but unfortunately also spaces which messes up the desktop file names. I have changed the code to reuse get_stripped_name in installer.py and updated get_install_directory_name since its basically the same.

@sharkwouter sharkwouter merged commit b0f01ab into sharkwouter:master May 16, 2024
2 checks passed
@sharkwouter
Copy link
Owner

Thanks for the fix! It's really appreciated!

@sharkwouter sharkwouter added this to the 1.3.0 milestone May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants