[SailfishDevel] xdg folder stuff: howto? more info

wsvries wsvries at xs4all.nl
Wed Jan 8 13:44:35 UTC 2014


Thanks Reto, Jonni,
I am still puzzled (please see harbour comments below).
I assume that the XDG naming is only to be used in the program code 
itself (not in .pro or .yaml).
So, I would need to replace (in .pro)

data.files = checklistsdata/*
data.path = /home/nemo/Documents/checklistsdata

with

data.files = checklistsdata/*
data.path = /usr/share/$NAME/checklistsdata

and in first execution copy /usr/share/$NAME/checklistsdata to 
$XDG_CONFIG_HOME/$NAME/checklistsdata or 
$HOME/.config/$NAME/checklistsdata
(though I would think that $XDG_DATA_HOME would be better)
The problem is that (certainly in my next app with loads of map data) 
data files end up in /usr/share/$NAME.
There is no way for the app (no root permission) to clean up the 
/usr/share/$NAME directory.

Comments from harbour:
--------
We do not allow to install files into /home/nemo from rpm. The user or 
the path for the home dir or the user under which the app runs could 
change in future! (btw that does not mean we have currently plans to do 
so!)

Please create the folder with parents during run time if it does not 
exist (following the XDG Base Directory Specification [0]). If files are 
needed, install them under /usr/share/$NAME and copy them during run 
time to $XDG_CONFIG_HOME/$NAME folder.
---------
Thanks.
regards,
wim


Reto Zingg schreef op 2014-01-08 10:54:
> Hi,
> 
> On 08.01.2014 10:55, Wim de Vries wrote:
>> Hi,
>> I am adding some more info to my question.
>> I am using QStandardPaths.
>> Harbour is refusing my app, stating that I should use $XDG_CONFIG_HOME
>> Still, this var is not set. The only ones are:
>> "XDG_SESSION_ID" value: "c5"
>> and
>> "XDG_RUNTIME_DIR" value: "/run/user/100000"
>> I need to add data files during installation, and the user should be
>> able to add/remove data files from his PC via USB.
>> Thanks.
>> 
> 
> The spec says:
> 
> If $XDG_DATA_HOME is either not set or empty, a default equal to
> $HOME/.local/share should be used.
> 
> If $XDG_CONFIG_HOME is either not set or empty, a default equal to
> $HOME/.config should be used.
> 
> AFAIK does QStandartPath not yet do the right thing, there is a bug.
> 
> 
> as the Harbour FAQs says about XDG_*_HOME:
>  _Do not_ create the subfolder in the rpm package, create it during
> _run time_ from the application!
> 
> I assume you create the folder already in the rpm? Put your files to
> /usr/share/$NAME and copy it form there to $XDG_DATA_HOME (if set
> resp. $HOME/.local/share/$NAME if not set) at launch.
> 
> Or it might also be that you use /home/nemo instead of $HOME? That
> your app got rejected.
> 
> br
> Reto
> 
>> 
>> 
>> On 01/07/2014 07:29 PM, Wim de Vries wrote:
>>> Hi,
>>> Can someone please explain how the XDG folders work.
>>> These env vars seem not be set when I try to read the values with
>>> QProcessEnvironment.
>>> So how can I read/write to those folders (C++)?
>>> And how to access them from QML?
>>> The documention/FAQ only gives a very general spec.
>>> I must be missing sth.
>>> Thanks.
>>> 
>>> _______________________________________________
>>> SailfishOS.org Devel mailing list
>>> 
>> 
>> 
>> 
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>> 
> 
> _______________________________________________
> SailfishOS.org Devel mailing list


More information about the Devel mailing list