portfolio-performance / portfolio

Track and evaluate the performance of your investment portfolio across stocks, cryptocurrencies, and other assets.
http://www.portfolio-performance.info
Eclipse Public License 1.0
2.93k stars 602 forks source link

Use XDG user directory specification instead of $HOME/.PortfolioPerformance #1922

Open Exordian opened 3 years ago

Exordian commented 3 years ago

Describe the bug Currently Portfolio Performance uses $HOME/.PortfolioPerformance/ for various files, please consider changing this to OS standards.

A small library for java can be found here: https://github.com/dirs-dev/directories-jvm

To Reproduce Steps to reproduce the behavior:

  1. Open Portfolio Performance
  2. $HOME/.PortfolioPerformance is created

Expected behavior Usage of XDG user directory spec on linux.

Desktop (please complete the following information):

buchen commented 3 years ago

You can change the location by editing the "osgi.instance.area.default" in configuration/config.ini.

I am relying on the Eclipse framework - and it needs the parameter passed when starting (or at least before my code runs).

buchen commented 3 years ago

Linked: https://bugs.eclipse.org/bugs/show_bug.cgi?id=200809

buchen commented 3 years ago

Note to myself: We could use variable substitution if a) the variable $XDG_DATA_HOME or $XDG_CONFIG_HOME is available on all Linux systems and if b) we find a way to check if there is already a directory in the old location (otherwise all columns configuration, etc. are lost).

MaxWipfli commented 3 years ago

Note to myself: We could use variable substitution if a) the variable $XDG_DATA_HOME or $XDG_CONFIG_HOME is available on all Linux systems and if b) we find a way to check if there is already a directory in the old location (otherwise all columns configuration, etc. are lost).

The XDG Base Directory Specification says that $XDG_CONFIG_HOME and $XDG_DATA_HOME are optional variables, and if they are not present, it should default to ~/.config and ~/.local/share instead. Sadly, I cannot really help you because I know nothing about this Eclipse framework you're using but if you have to pass the directory on startup, this is only possible if you have the possibility to run arbitrary code before defining this (as you have to check if the environment variables exist and default otherwise).