On 14 Mar 2014, at 11:37, Ove Kåven <o...@arcticnet.no> wrote:
> Den 13. mars 2014 19:22, skrev Iosif Hamlatzis:
>> Thank you very much, I've just tested my game using the XDG basedir and
>> it worked so I can continue my port of the game by modifying the rest of
>> the code.
>> 
>> Just one question, will the folders under .config/.cache/.local be
>> removed if I uninstall the game? I've noticed that using the XDG basedir
>> to read the environment variables I get something like:
>> ..../..../<MyGameName> but no folder is created, so I programmatically
>> created the <MyGameName> folder and placed my config (read/write) files.
>> 
>> Since the GUI from the emulator doesn't uninstall the actual game I ssh
>> into the emulator and called "zypper remove <MyGameName>" and it was
>> uninstalled but the folders with all their contents I had created
>> weren't erased. If this happens in the actual device then at some point
>> there isn't going to be any space available on the device.
> 
> I think you shouldn't worry about it, just leave the files in $HOME alone. I 
> believe one of the reasons Jolla Harbour is trying to enforce that Harbour 
> apps only write app-specific stuff into $HOME/.config/appname (instead of 
> anywhere it likes under $HOME) is so that it will be easy for the Jolla Store 
> to remove that directory when uninstalling. I don't think it does it yet, but 
> it appears to be what they want it to do eventually. In any case, the rpm 
> itself shouldn't worry about it.

Exactly right :) Your RPM doesn’t need to worry about it (in fact, can’t - 
there’s no way at package build time to determine what XDG will resolve to at 
runtime), and following the directory rules means the system can show per-app 
disk usage, allow users to clear the cache directory (even while the app is 
still installed, that’s why it’s called “cache” - no data in cache should be 
something that can’t be deleted between invocations without losing user data), 
allow users to reset the app configuration (again, while the app is still 
installed - resetting the configuration without affecting the user data; that’s 
why you should only put configuration settings in the config dir, and put user 
data into the data dir) can have per-app backup and restore and can clear app 
data on app uninstall, have per-TOH “profiles" for certain apps (example: TODO 
list with work TOH shows different contents than TODO list with party TOH), etc…

And as Ove pointed out, this is not done yet, but will be done at some point in 
the future (having apps put their data into the right subfolder [named like the 
app name] of XDG basedir is a prerequisite for that) - in any case, something 
that app developers shouldn’t need to worry about implementing themselves, just 
follow the XDG basedir spec with the addition of using the app name as 
subdirectory (as described in the Harbour FAQ) and expect that the system will 
handle clearing and backing up of cache, config and data (eventually).


HTH :)
Thomas
_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to