Place for settings files

Hi. I create snap package of my flutter app.

I have problem, because I don’t permissions in my snap for saving file.
[ERROR:flutter/lib/ui/] Unhandled Exception: FileSystemException: Cannot open file, path = '/home/michal/Documents/settings.hive' (OS Error: Permission denied, errno = 13)

I can give access for home directory per snap, but I would like hide this file. Is possible in snapcraft maping directory and keeping it inside? (There is no important data there, but why keep it in the documents?)

Library from flutter find the local path: /home/michal/Documents/settings.hive

1 Like

The normal place for Linux apps to store settings is $XDG_CONFIG_HOME (or, if that isn’t set, $HOME/.config). [ref:]

You should find your snap has $HOME overridden to something like /home/michal/snap/yoursnap/1 and you should create and use a $HOME/.config directory for your settings file.

1 Like