twnlink / LinuxED

LinuxED is an installer for EnhancedDiscord specifically made for Linux and MacOS.
MIT License
21 stars 7 forks source link

Store "EnhancedDiscord" in either $XDG_DATA_HOME or $XDG_CACHE_HOME (Linux) #2

Closed Freso closed 5 years ago

Freso commented 5 years ago

From the XDG Base Directory Specification:

$XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored.

$XDG_CACHE_HOME defines the base directory relative to which user specific non-essential data files should be stored.

Currently "EnhancedDiscord" is extracted to the directory the script is in, which can clutter the file system and in case LinuxED.py is installed system‐wide, it may not be allowed at all (e.g., "FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/EnhancedDiscord/config.json'"). The "XDG Base Directory Specification" was made to address these issues.

Depending on whether the resulting "EnhancedDiscord" directory is either a data directory that needs to be revisited continuously (e.g., this is where the ED extension "lives") or if it’s treated more like a cache (it’s downloaded and then gets installed into Discord’s own directory/‐ies) the "EnhancedDiscord" directory should be placed under $XDG_DATA_HOME (first case) or $XDG_CACHE_HOME (second case).

twnlink commented 5 years ago

The official EnhancedDiscord installer allows you to install it to any directory you'd like, and LinuxED was originally modeled after it. After some consideration, as the official EnhancedDiscord installer is made entirely for Windows, I will be defaulting to $XDG_DATA_HOME with optional support for the current directory relative to where the user is. As of now I am very busy with things so this may not happen as fast as I'd like it to.

twnlink commented 5 years ago

In commits f11970242ca60127b283a6dc53c27a2909a7183d and 8c10740d8070aff024b76964f92eed822ef41baa, I changed the way the updater works and how the installer handles directories relative to where the user is. I believe this to be a fine alternative to using $XDG_DATA_HOME or $XDG_CACHE_HOME as this allows users to have more fine control over where their EnhancedDiscord installation will go. You can now install LinuxED system-wide and not have to worry about updates or installation breaking.

Therefore, I do not believe XDG_CACHE_HOME is needed and this issue will be closed.

Freso commented 5 years ago
  1. I still think $XDG_{DATA,CACHE}_HOME should be used. Not just because it allows to run the binary from anywhere, but because it also means that there’s a standardised place for all of these kinds of files to be placed, so a user doesn’t have to hunt through their $HOME trying to find out where this or that program decided to store their data or cache files.
  2. It still doesn’t allow for LinuxED to be installed globally (e.g., in /usr/bin) and run from anywhere. E.g.,:
    
    freso@koume ~/D/A/linuxed (master)> LinuxED.py
    Welcome to the LinuxED installation script.

Operating on client: STABLE 0.0.9

Please type the number for your desired option:

  1. Install ED
  2. Uninstall ED
  3. Update ED
  4. Update LinuxED
  5. Select Client
  6. Exit

    3

It seems EnhancedDiscord is not installed in the current directory so it was unable to be updated. Please type the number for your desired option:

  1. Install ED
  2. Uninstall ED
  3. Update ED
  4. Update LinuxED
  5. Select Client
  6. Exit

    1

Uninstalling EnhancedDiscord... Successfully uninstalled EnhancedDiscord! Downloading ED... Creating index.js.backup... Patching index.js... Creating config.json... EnhancedDiscord installation complete!

Please type the number for your desired option:

  1. Install ED
  2. Uninstall ED
  3. Update ED
  4. Update LinuxED
  5. Select Client
  6. Exit

    6

Exiting... freso@koume ~/D/A/linuxed (master)> cd ../.. freso@koume ~/Development> LinuxED.py Welcome to the LinuxED installation script.

Operating on client: STABLE 0.0.9

Please type the number for your desired option:

  1. Install ED
  2. Uninstall ED
  3. Update ED
  4. Update LinuxED
  5. Select Client
  6. Exit

    3

It seems EnhancedDiscord is not installed in the current directory so it was unable to be updated. Please type the number for your desired option:

  1. Install ED
  2. Uninstall ED
  3. Update ED
  4. Update LinuxED
  5. Select Client
  6. Exit