flatpak portal example on github
Winnie Poon
winniepoon_home at hotmail.com
Fri Nov 22 01:48:22 UTC 2019
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 🙁
________________________________
From: Matthias Clasen <mclasen at redhat.com>
Sent: November 21, 2019 4:11 PM
To: Winnie Poon <winniepoon_home at hotmail.com>
Cc: Jorge García <jgarciao at gmail.com>; Jan Grulich <jgrulich at redhat.com>; Flatpak List <flatpak at lists.freedesktop.org>
Subject: Re: flatpak portal example on github
On Thu, Nov 21, 2019 at 6:03 PM Winnie Poon <winniepoon_home at hotmail.com<mailto:winniepoon_home at hotmail.com>> wrote:
Hi Jorge,
i'm using the libportal together with the portal test example. I'm trying to understand how to open a file in my home folder inside the sandbox without using --filesystem=/home/user. I tried the File Chooser on the UI and clicked Save As but that doens't seem to copy the original file content, but just write "test" to a file. I couldn't find an example how open up a file to be accessible inside the sandbox. Am i looking at the wrong place?
You want to open an existing file for reading, or write something to a new file?
Using the portal for this purpose should be essentially identical to using a "traditional" file chooser from your toolkit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/flatpak/attachments/20191122/ed84dffd/attachment-0001.html>
More information about the Flatpak
mailing list