I started developing an application to backup Flatpak applications.
According to Flatpak documentation, application configs are default located in ~/.var/app/<app-id>/config
.
What I don't understand though is that the base directories of this path is XDG_CONFIG_HOME
which defaults to $HOME/.config
.
If I understood correctly, the path for application config is constructed like this : $XDG_CONFIG_HOME/~/.var/app/<app-id>/config
. But then this is the same as only ~/.var/app/<app-id>/config
.
So, what are the differences between using $XDG_CONFIG_HOME/~/.var/app/<app-id>/config
or ~/.var/app/<app-id>/config
?
And what I misunderstand ?
$XDG_CONFIG_HOME
is an abstraction of the application's configuration path. This path is usually ~/.var/app/<app-id>/config
, but not always. If the application is granted certain permissions, for example, permission to access the user's /home
, this path may change.
Using $XDG_CONFIG_HOME
instead of ~/.var/app/<app-id>/config
ensures that the application will continue to find the correct path regardless of how access permissions change.