Thank you for updating the Harbour FAQ, but the config files are not covered yet. As I wrote previously, QSettings is using ~/.config/<organizationName>/<appName>.conf file, not ~/.config/<organizationName>/<appName> directory.
I somewhat disagree - the config files are covered. It just isnât mentioned that QSettings by default uses path which isnât compatible with Harbour rules. I would consider this a bug in QSettings, but we havenât really decided yet what to do about it. In any case, for the time being, I suggest using QSettings by giving it a full path to the file.
Could you make an official announcement with all those suggestions when this is the time? (when 4.3 is released I suppose)
It would be cool to have a quick FAQ and concrete examples, covering that kind of things:
- The fact that we need to change our app name (or actually, set one, until now it just defaulted to
harbour-myapp)- Also the recommended format for the organizationName
- The fact that the renaming will make all apps losing their cache/config since the paths will change
- Maybe how we can avoid that without asking users to copy the directories manually?
- What exact change do we need to make for this QSettings âbugâ
Taking into account that QSettings have been always using this path, I wouldnât consider it as a bug and it seems to me that Harbour rules would have to account for it. Not that we can file QT BUG and hope for it to be fixed, right?
Sure thing, will do!
@vige, karryâs statement
contradicts your statement in your blog entry about the firejail-based sandbox implemented for SailfishOS:
with the default profile you will get ~/{.local/share,.config,.cache}/packagename directories mounted inside the sandbox.
I hope I am misunderstanding something, because @karryâs observation means the all applications (which use a ~/{.local/share,.config,.cache}/packagename directory; that is almost every app) will cease to run on SailfishOS â„ 4.4 without being adapted.
Thus my concern is, if the statement âthe default profile will mount ~/{.local/share,.config,.cache}/packagename inside the sandboxâ still is conformant to Jollaâs plans / implementation?
I hope this helps: Migrating configuration and data files for sandboxed apps
@vige, I cannot see that your new thread you are linking to answers @Sthocsâ questions, even though you replied âSure thing, will do!â and now replied to this post of yours that you âhope this helpsâ.
Hence answers to @Sthocsâ questions for proper guidance to Jollaâs sandboxing still would be helpful, e.g., if app names with the âharbourâ prefix (e.g., harbour-myapp) are technically still feasible when an app has activated the sandboxing (that was rather implicitly asked).
P.S.: It also would be helpful to know if the workaround @nephros suggested is going to be technically prevented or not. Even though that sure is not what you intended, I might be helpful as a quick & dirty workaround for developers who publish their apps at Openrepos or chum and are slow to fully adapt to Jollaâs sandboxing rules.
Side note: For me the intentions for such a fine grained âorganisationâ directory structure is not fully obvious, especially as it is a 180° turn from the old rules (i.e., every app has to have harbour- prefixed if it is going to be submitted to the Jolla Store, which was definitely more awkward, but one became used to it over the years).
Hi @vige , is everything with Sailjail going as planned? Will be Sailjail enabled in Harbour for community applications after official release SFOS 4.3?
Yes, so far everything is going as planned. But as usual, you can expect a few hiccups in the first few days after the release. So if you have any trouble getting your apps in Harbour, please tell me so I can check if there is anything I can do to help.
My dear forum,
Somehow I am stumped
I have an old app (I wrote it in 2016) that attempts to save some data in an .xml file in the folder: QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).
This location ($HOME/.local/share/<OrganizationName>/<ApplicationName>) is suggested by Jolla (GitHub - sailfishos/sailjail-permissions · GitHub), as well known. When I test my app in the emulator, everything works fine and data are saved and imported when starting the app again. Yet, when I deploy the app on my Xperia iii, the app does not save the data into a file, does not even create the file, nor does it load data from an existing file (if I manually place a data file there). But why? It worked until 2024⊠so s.th. might be wrong with the sailjail config???
Following the content of the harbour-app.desktop file (Permissions are empty, since the app does not use any additional access):
[Desktop Entry]
Type=Application
X-Nemo-Application-Type=silica-qt5
Icon=harbour-app
Exec=harbour-app
Name=MyApp
[X-Sailjail]
Permissions=
OrganizationName=harbour-app
ApplicationName=harbour-app
- When I start the app in the terminal, the output states some missing libraries when the app starts indeed. But except of few irrelevant warnings, the app prints no error to the console that is anyhow related to file handling.
- When I search for the file with the name specified in the source, I canât find it anywhere. So, the file simply does not exist - strangeâŠ
Do I have to give special permissions to the app? I carefully studied the sailjail-permissions but can not figure out what the problem for this issue is⊠![]()
Any help or advice is highly appreciated.
Regards, aimless
One important thing about the emulator is that it doesnât (afaik) actually apply SailJail rules.
that attempts to save some data in an .xml file in the folder:
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).
Did you set ApplicationName and OrganizationName (in C++) before the first call to QStandardPaths::writableLocation?
If you like, a while ago I put up GitHub - nephros/sailjail_test · GitHub which can help understand how SailJail or apps under SailJail handle file locations. It can be quite surprising/confusing indeed.
Very interesting. This would explain why it works on the emulator but not on the target.
The ApplicationName and OrganizationName are set in the .desktop file - isnât it?
I didnât set it anywhere else.
When started in the terminal (using the plain binary name), Sailjail will not apply.
To test from console with SailJail, use
sailjail -p <<desktop file name without .desktop>> /usr/bin/binary
# so
sailjail -p harbour-app /usr/bin/harbour-app
(actually you can skip the -p harbour-appiff the binary has the same name as the .desktop, but sometimes thatâs not the case so I think itâs a good habit to always have it.)
This is a very cool app. I installed it on my Xperia iii and run it. After,
- I clicked on the
Datalocation. The app showed the content. - I clicked on the button
Set Orga and App names, clicked on theDatalocation again and the app attempt to open the Data folder with the following message:
No permission to access /home/defaultuser/.local/share/OraNameFromQML/AppNameFromQML
When I try to create a new folder in the Data location, I get the message that the app could not do itâŠ
OraNameFromQML
hmm I may have a typo somewhere in there. Itâs probably supposed to be OrgaNameFromQML.
Well, I quickly changed it. But the result remained the same: No permission to access /home/defaultuser/.local.share/OrgaNameFromQML/AppNameFromQML
Well it is a typo, but OraName is correct ATM.
Note that dirs are set up by Sailjail according to the .desktop entries on program launch.
While you can change them later (e.g. in QML), this will NOT give access to other paths. Thatâs why you see the âerrorâ.
Good to know. Thank you.
In the meantime I tried to create a simple file in the Data directory by means of the following Pull-Down-Menu entry:
MenuItem {
text: qsTr("Make File")
onClicked: {
var request = new XMLHttpRequest();
request.open("PUT", "/home/defaultuser/.local/share/harbour-app/harbour-app/filename.xml", false);
request.send('hello world')
}
}
The app called in the terminal produced the output:
QIODevice::write(QFile, ââŠpathâŠâ): device not open
hmmm⊠probably I messed up something.