-
Notifications
You must be signed in to change notification settings - Fork 787
core, gtk: implement host resources dir for Flatpak #6661
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
base: main
Are you sure you want to change the base?
Conversation
4d88103
to
53e5efc
Compare
53e5efc
to
f76d334
Compare
Changes in v2:
|
f76d334
to
4982c0d
Compare
Changes in v3:
|
e1e708a
to
9aa7f5d
Compare
Changes in v4:
|
src/global.zig
Outdated
@@ -170,9 +176,18 @@ pub const GlobalState = struct { | |||
|
|||
// Find our resources directory once for the app so every launch | |||
// hereafter can use this cached value. | |||
self.resources_dir = try internal_os.resourcesDir(self.alloc); | |||
self.resources_dir = rd: { | |||
if (@hasDecl(apprt.runtime, "resourcesDir")) break :rd try apprt.runtime.resourcesDir(self.alloc, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We try to avoid @hasDecl
in new apprt-related code, although I'm not exactly sure what's a better alternative here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its better, but I still don't love this approach...
Calling resourcesDir
twice once for guest once for host is not great, especially since 99% of users (today, but a significant number) are not running in a sandboxed mode. Its just waste.
A perhaps better approach would be to return a struct instead so we can get all the info in one call. But stepping back its not clear to me if we ever need both, would it be more useful to redocument resourcesDir
as always being host accessible?
For platforms like Flatpak the host-accessible directory is usually non-accessible in the sandbox, but the sandbox path is not accessible outside. We need sandbox-accessible paths for things like reading bundled themes, and only termio needs the host-accessible one since that's where host processes are launched. So on Flatpak you'd want both to implement all the features. |
9aa7f5d
to
de54443
Compare
Changes in v5:
|
Introduces host resources directory as a new concept: A directory containing application resources that can only be accessed from the host operating system. This is significant for sandboxed application runtimes like Flatpak where shells spawned on the host should have access to application resources to enable integrations. Alongside this, apprt is now allowed to override the resources lookup logic.
de54443
to
696d3b2
Compare
Introduces host resources directory as a new concept: A directory containing application resources that can only be accessed from the host operating system. This is significant for sandboxed application runtimes like Flatpak where shells spawned on the host should have access to application resources to enable integrations.
Alongside this, apprt is now allowed to override the resources lookup logic.