dsda-doom icon indicating copy to clipboard operation
dsda-doom copied to clipboard

Change data directory if running as Flatpak

Open spazzylemons opened this issue 1 year ago • 3 comments

This is part of an attempt I'm making to create a Flatpak port of DSDA-Doom to make it easier to install for more Linux users (see #460). This change has the application check if it is running under Flatpak by checking if the /.flatpak-info file exists, and if it does, it changes where the .dsda-doom folder is stored to be within the application's personal filesystem. Without this change, the application would need access to all files in the user's home folder.

spazzylemons avatar Dec 16 '23 22:12 spazzylemons

I think we probably want something more general here and should respect the xdg_data_home standard more broadly (there's another PR also moving in that direction). Maybe something like this:

  1. Check if old $HOME/.dsda-doom exists -> if it does, then use it (i.e., be backwards compatible with existing installations)
  2. Check if $XDG_DATA_HOME exists -> if it does, use $XDG_DATA_HOME/dsda-doom (I assume no preceding . is used in this case)
  3. If it doesn't exist, use $HOME/.dsda-doom as before

What do you think?

kraflab avatar Dec 17 '23 03:12 kraflab

Sounds good -- if $XDG_DATA_HOME isn't defined, should $HOME/.local/share be used as a fallback as per the standard, or should $HOME/.dsda-doom be created in that case?

spazzylemons avatar Dec 17 '23 03:12 spazzylemons

Oh sure, you can go with the .local/share one for consistency

kraflab avatar Dec 17 '23 13:12 kraflab