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

[RFC] Mac: filesystem permission issues #2849

Open
tyrone-sudeium opened this issue Oct 6, 2022 · 1 comment
Open

[RFC] Mac: filesystem permission issues #2849

tyrone-sudeium opened this issue Oct 6, 2022 · 1 comment
Labels
FileFinder macOS RFC Request for comments, for taking development design decisions

Comments

@tyrone-sudeium
Copy link
Member

Name of the game:

All games

Player platform:

macOS Mojave (10.14) or later

Attach files (as a .zip archive or link them)

This issue is not game-specific.

Describe the issue in detail and how to reproduce it:

Modern macOS is becoming increasingly restrictive about which folders applications are allowed to read and write to, and users could be storing their games anywhere but most likely they're putting them in places that macOS considers protected, such as ~/Desktop, or ~/Downloads, or ~/Documents, etc. This can cause write issues when trying to save, or even just the Player launching to an empty game browser, and the user gets very little (if any) feedback as to why.

To that end, I have two proposals:

  1. We should write all saved games to ~/Application Support/EasyRPG Player/[game-specific prefix]/.
  2. We should present an Open File dialog when the Player launches.

Saved games

Pros:

  • No special permission needed to write here

Cons:

  • Users updating the Player will no longer see their save games and will have to manually move them to the new folder. Depending on how we choose the game-specific prefix, it might be difficult to work out what the new folder even is. Plus, Apple hides the ~/Application Support directory by default... We might want to consider copying all existing saves to the new folder if it doesn't exist?
  • Might break some user's workflows, such as if they keep their games on an iCloud Drive, Dropbox or the like (and the ~/Documents folder is iCloud Drive synced by default these days).

Open File Dialogs

Depending on where people put their games the Player will pop up various directory permission prompts on first launch and I suspect some folks are inadvertently rejecting those which then makes the Player effectively useless, and it won’t ask for this permission again, and manually granting it is quite a faff.

Apple wants you to get permission to read into these protected directories by opening a standard Open File Dialog (or any other user initiated action, such as drag-and-drop, etc), and that implicitly grants you permission to read the contents… doing it this way lets users do the natural thing of just putting EasyRPG Player.app in their /Applications folder and letting it show a Open File Dialog on launch for which game they want to open. If the folder they choose doesn't have a game in it, we start the game browser pointed at that directory instead.

Pros:

  • Supports users who just want to install EasyRPG Player.app into their /Applications folder like any other macOS app.
  • Since access to the game folder is explicitly granted by the user via the system Open File Dialog, it should avoid the permission prompts entirely.

Cons:

  • If the user puts the EasyRPG Player.app inside their game folder and the game folder is in a protected directory, the Player is still going to try to discover the game in the same directory as the .app and therefore trigger the permission popup anyway. There's no API to determine if you've already been granted this permission, too, the only way to try to read there and then you'll either get your popup + file handle, or an error. The only way to avoid it entirely is to not support dropping the Player in the game directory, which every other platform supports...

I'm open to discussion on exactly what the logic should be but honestly I'm tempted to make it so Mac only supports launching games with either the Open File Dialog, or if the game is packaged inside the .app to just start up directly (is this implemented yet?). We can make the dialog less annoying too by having it remember the previously chosen directory and starting there on subsequent launches.

I will be on vacation until November 2nd but plan to start work on a pull request not long afterward, if you'd like to bikeshed some of the specifics of this proposal, doing so before I start coding would be appreciated 😂

@carstene1ns
Copy link
Member

This has the same problem like #1928. Game directories will sooner or later conflict.

@fdelapena fdelapena added FileFinder macOS RFC Request for comments, for taking development design decisions labels Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FileFinder macOS RFC Request for comments, for taking development design decisions
Development

No branches or pull requests

3 participants