user234683 / youtube-local

browser-based client for watching Youtube anonymously and with greater page performance
GNU Affero General Public License v3.0
540 stars 65 forks source link

Use XDG Base Directory for storing data #204

Open shutosheep opened 8 months ago

shutosheep commented 8 months ago

Checks if environment variable XDG_CONFIG_HOME is set and uses it as config directory. If set, data will be stored at $XDG_CONFIG_HOME/youtube-local. If not set, it will default to ~/.config/youtube-local.

Closes #193

user234683 commented 5 months ago

Sorry for the late reply. Comments:

  1. Need to read the old paths ~/.youtube-local to see if there are configuration files in there. I.e., if there is nothing in ~/.config/youtube-local nor in the XDG directory, but there is data in the old paths, then use the old paths. Otherwise, if I push an update, people's settings and data which is currently stored there will not be loaded, creating confusion and problems
  2. I don't think data should be stored in the config folder too, we should store it in XDG_DATA_HOME which defaults to ~/.local/share, no?
shutosheep commented 5 months ago

Need to read the old paths ~/.youtube-local to see if there are configuration files in there.

I will make it check if settings.txt file is found in old ~/.youtube-local directory. If found, it will use the old ~/.youtube-local directory and if not, use the XDG directory.

I don't think data should be stored in the config folder too, we should store it in XDG_DATA_HOME which defaults to ~/.local/share, no?

I'm not sure about this, since I have little knowledge of XDG base directory. But as far as I read the XDG Base Directory Specification, I think that your suggestion is better. I will change it to store in XDG_DATA_HOME.

user234683 commented 3 months ago
  1. We should use $XDG_DATA_HOME for the data and $XDG_CONFIG_HOME for the settings, rather than using $XDG_DATA_HOME for both
  2. I realize we should stick with the old way on Windows since it doesn't use XDG. Make sure to add a check for that