flatpak portal example on github

Matthias Clasen mclasen at redhat.com
Fri Nov 22 02:18:45 UTC 2019


On Thu, Nov 21, 2019 at 8:48 PM Winnie Poon <winniepoon_home at hotmail.com>
wrote:

> I'm trying to access a file in say /home/user/hello.txt, which is normally
> not accessible from sandbox without doing (--file-system=/home/user), so i
> want to access this file via the portal (without the --file-system
> permission), get the content.
>
> I thought for the portal test example, the file chooser open together with
> the "Save as ..." button will do that but apparently the "Save as..." only
> create a new file with a hardcoded "test" content.
>
> e.g. there's a file /home/user/hello.txt
> if I open up the --filesystem=/home/user, then i can do
> g_file_get_contents("/home/user/hello.txt, ...." to see the file, but
> without the ---filesystem=/home/user, hello.txt cannot be seen.
>
> My understanding is the gtk_file_chooser API will communicate iwth the
> dbus API to open up permission to hello.txt? but i'm having trouble getting
> the code to do that.
>
> Sorry i'm a bit confused 🙁
>
>
This all seems perfectly correct. Except for "Save As" - if you want to
read an existing file, you should use  a file chooser with
GTK_FILE_CHOOSER_ACTION_OPEN, not GTK_FILE_CHOOSER_ACTION_SAVE_AS.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/flatpak/attachments/20191121/5c396891/attachment.html>


More information about the Flatpak mailing list