-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
document-portal: Implement GetHostPaths #1364
Conversation
2b14a3d
to
fcd4916
Compare
You also need to update the documentation of the Document portal interface, since it still mentions version 4. |
fcd4916
to
21f004f
Compare
21f004f
to
067edad
Compare
A bunch of minor issues and nits but LGTM overall. |
067edad
to
d0fb2ab
Compare
Thanks for bringing my work to en end. glib is not easy to use. I have one small suggestion however: I used |
It's exactly like that. It's a |
No. "Most people" will take that path and feed it to some platform-specific API, like The only place where you want UTF-8 is displaying the path into some UI; for that you will need to convert the path to UTF-8, using functions like Stop trying to enforce UTF-8 into Unix paths: that's not how Unix paths work. |
I should have read carefully the rest of your comment as I misunderstood so ignore what I wrote above. I think using
|
I mean that the returned path should be |
But it shouldn't. |
That's exactly the use case for this API. The path is only to the displayed in the UI. It doesn't exists in the Sandbox. You can't use any filesystem related functions with it. If doesn't make sense here to let programs figure out the encoding here, which will lead to errors.
Why? |
Paths are not UTF-8, not when you get the path from syscalls, not when you get them from clipboard, not anywhere. Apps already deal with that fact and are able to display them. Let's not make this simple thing hard for no reason. |
That's not true. Not everyone is a C developer. Many modern programming languages have a set encoding for strings (e.g. Java and JavaScript uses UTF-16, python uses UTF-8). There is simply no need to deal with path encoding as a programmer of those languages. Not everyone writes low level programs.
I'm trying to make this easier. If you design a function that returns an UTF-8 string in 99% and a string in another encoding in 1% of times, that will cause trouble. Where should a programmer even know, which encoding this is? |
Hi, can we finally make a decision on this change if it's good code-wise? |
Code LGTM but this needs a maintainer to take a look as well. @GeorgesStavracas, @ebassi, anyone else? |
d0fb2ab
to
f205e9d
Compare
Maybe @matthiasclasen can look into this? This needs mostly approval for the API change I guess since the code has received quite a good review. |
A couple +1s from me:
|
Answering my own question: it'd be really confusing if the file is in the same place in the sandbox as it is on the host system. Imagine moving the file in the sandbox from one location to another, but it stays in the same place on the host. That's just asking for bugs. The question was not smart. |
In addition to what @mcatanzaro said, this might be possible some of the time, but in general is not going to be possible all of the time - for example Flatpak often mounts locations from the host read-only, and that is irreversible while the sandbox is running (the only process that ever had the necessary capabilities to be able to change mount options has already given them up by the time the app talks to portals). |
Did some xattr experimentation for other reasons and noticed that putting the host path there is pretty easy.
|
f205e9d
to
84effda
Compare
We can have this as an additional way to get the host path, but I think this (or any other one) DBus API will be easier to discover and use for most of the clients. I know there is an API for this in GIO, but for example Qt doesn't seem to have nice API for this. |
Yes, I'm still 100% in favor of this portal addition and would like to see it merged. |
8c5a06e
to
e77e8a5
Compare
This method allows apps to get path as exists on the host filesystem for documents exported through the document portal. This method takes a list of document IDs as a string array and returns a dictionary mapping document IDs to the paths in the host filesystem. It is expected an app making this request to have access to given list of documents. This is based on initial work made by @JakobDev Fixes flatpak#475
e77e8a5
to
730b45a
Compare
Thanks! |
@swick I'd like to have the xattr one too, mind proposing a PR for that? |
Thanks @GeorgesStavracas for merging this. Also kudos to @JakobDev for initial version of this change!! |
This method allows apps to get path as exists on the host filesystem for documents exported through the document portal.
This method takes a list of document IDs as a string array and returns a dictionary mapping document IDs to the paths in the host filesystem. It is expected an app making this request to have access to given list of documents.
Based on initial work made by @JakobDev
Fixes #475