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

[macOS, sandbox] Implement optional native file selection dialog support for sandboxed apps. #47499

Merged
merged 1 commit into from
Jul 14, 2023

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Mar 30, 2021

Alternative to #47056, implements godotengine/godot-proposals#1123 on macOS.

Adds ability to access arbitrary folders for macOS sandboxed apps (EntitlementsApp SandboxEnabled is selected during export).

  • Adds files.user-selected entitlement support to the export dialog.
  • Adds OS.is_sandboxed() to detect running in the macOS sandbox.
  • Adds DisplayServer.file_dialog_show() to display native file selection dialog. Which also saves security-scoped bookmarks for selected files/folders, to automatically gain access in the next session.
  • Adds FileDialog.use_native_dialog property to seamlessly integrate native dialog to existing apps, disabled by default, used automatically when sandboxed app is accessing file system.
  • Implements OS_OSX::get_granted_permissions() to get list of accessible folders/files.
  • Adds OS.revoke_granted_permissions() to clear list of accessible folders/files.
  • Can be used in non-sandboxed apps.

@bruvzg bruvzg added this to the 4.0 milestone Mar 30, 2021
@bruvzg bruvzg requested review from a team as code owners March 30, 2021 15:03
@bruvzg bruvzg force-pushed the mac_native_fd branch 3 times, most recently from 99ef60b to d8abca9 Compare August 12, 2021 19:34
@bruvzg bruvzg force-pushed the mac_native_fd branch 2 times, most recently from 812af04 to 38d5173 Compare August 24, 2021 10:32
@bruvzg bruvzg force-pushed the mac_native_fd branch 2 times, most recently from 25ec9e7 to 6b75946 Compare September 27, 2021 09:41
@bruvzg bruvzg force-pushed the mac_native_fd branch 3 times, most recently from ec78dd4 to 2cce949 Compare August 27, 2022 18:25
doc/classes/OS.xml Outdated Show resolved Hide resolved
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

Seems good to me overall, but let's keep it for 4.1 since we're now at RC.

My main concern with this PR is not specific to the changes here, but more to my ever growing feeling that we have too many single-platform-specific APIs in OS/DisplayServer which make these abstract APIs harder to parse IMO.

I'd like a system where we can easily add platform-specific features to platform singletons (MacOS, Android, etc.) so we don't have to make all these behaviors virtual in the abstract class, to implement them only on one platform. But that's outside the scope of this PR completely, and so far it's almost mostly my personal pet peeve, not necessarily a widespread consensus that this is how we should do this.

doc/classes/OS.xml Outdated Show resolved Hide resolved
@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 12, 2023
@YuriSizov
Copy link
Contributor

@bruvzg This needs a rebase and addressing Remi's documentation notes, please 🙏

@YuriSizov YuriSizov merged commit c2d0c52 into godotengine:master Jul 14, 2023
13 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants