Opened 14 years ago

Last modified 9 years ago

#6664 closed enhancement

Josm config files should be in $XDG_CONFIG_HOME instead of ~/.josm — at Version 7

Reported by: anonymous Owned by: team
Priority: normal Milestone: 16.10
Component: Core Version:
Keywords: Cc: spam-josmtrac@…, AMDmi3

Description (last modified by bastiK)

Josm configuration and user files should be in $XDG_CONFIG_HOME and $XDG_DATA_HOME respectively, as described in the XDG Base Directory Specification: <http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>.

Josm stores its user files in ~/.josm, instead. This clutters the $HOME directory and makes it hard to backup Josm's settings in a easy way.

Change History (7)

comment:1 by olejorgenb, 14 years ago

A workaround is to run josm as:

APPDATA=$XDG_CONFIG_HOME java -jar josm.jar

comment:2 by bastiK, 14 years ago

So it would look like this (just using the default paths for simplicity):

~/.josm/motd.html           --> ~/.cache/josm/
~/.josm/plugins/site-josm.openstreetmap.de-_plugins.txt
                            --> ~/.cache/josm/
~/.josm/mirror_http___planet.openstreetmap.org_users_agreed_users_agreed.txt 
                            --> ~/.cache/josm/
(and other mirror files the same)
~/.josm/wms-cache           --> ~/.cache/josm/wms
~/.josm/imagery/cache       --> ~/.cache/josm/imagery

~/.josm/autosave            --> ~/.local/share/josm/
~/.josm/plugins/*.jar       --> ~/.local/share/josm/plugins/

~/.josm/preferences         --> ~/.config/josm/

Same applies for plugins that currently put all their stuff in ~/.josm/plugins/PLUGIN_NAME.

---

Not sure if it is a particularly good idea, though. Sometimes JOSM breaks due to a corrupt cache file or a certain configuration option triggers a serious bug. Then we tell people to simply remove their ~/.josm or %appdata%/JOSM folder respectively. For a stable software, this kind of radical measure shouldn't be necessary. But JOSM is constantly evolving and we do our best, but we don't have enough man power to care for super-stable interfaces.

Now, when configuration, data and cache files are spread over multiple folders, it is cumbersome to reset the state completely. It is much simpler if everything is at one place.

in reply to:  1 comment:3 by bastiK, 14 years ago

Replying to olejorgenb:

A workaround is to run josm as:

APPDATA=$XDG_CONFIG_HOME java -jar josm.jar

I'd write java -Djosm.home=$XDG_CONFIG_HOME -jar dist/josm.jar.

in reply to:  2 comment:4 by anonymous, 14 years ago

Replying to bastiK:

Same applies for plugins that currently put all their stuff in ~/.josm/plugins/PLUGIN_NAME.

Wouldn't it be better to expose some API to the plugins like File getConfigDir(), File getDataDir(), File getCacheDir()?

Not sure if it is a particularly good idea, though. Sometimes JOSM breaks due to a corrupt cache file or a certain configuration option triggers a serious bug. Then we tell people to simply remove their ~/.josm or %appdata%/JOSM folder respectively. For a stable software, this kind of radical measure shouldn't be necessary. But JOSM is constantly evolving and we do our best, but we don't have enough man power to care for super-stable interfaces.

Now, when configuration, data and cache files are spread over multiple folders it is cumbersome to reset the state completely. It is much simpler if everything is at one place.

Wouldn't instead be easier to say "First remove ~/.cache/josm. If that did not work, try removing ~/.config/josm. Is the problem solved now? Did you need to remove the config or was the cache enough?" You would get much better bug replies with that.

I wouldn't mind removing only my cache first, instead of losing all my configuration.

Anyway, if you need a quick workaround, please use java -Djosm.home=${XDG_DATA_HOME:-~/.local/share/} -jar dist/josm.jar, so that all the files end up in the DATA dir, not CONFIG dir (that is often backed up and treated as a collection text files).

comment:5 by bastiK, 14 years ago

I could imagine, that we have getConfigDir(), getDataDir() and getCacheDir() in JOSM core and they all point to ~/.josm or %APPDATA%/JOSM by default. In addition to -Djosm.home there would be 3 more switches to configure these folders as desired.

comment:6 by bastiK, 14 years ago

Type: defectenhancement

comment:7 by bastiK, 14 years ago

Description: modified (diff)

Introduced global cache folder ~/.josm/cache (see [4810], [4812], [4813]).

You can write a run script that makes JOSM use the XDG folders.

Example:

java -Djosm.home=$XDG_CONFIG_HOME -Djosm.cache=$XDG_CACHE_HOME -jar josm.jar

TODO: user data in a separate folder ($XDG_DATA_HOME)

Last edited 14 years ago by bastiK (previous) (diff)
Note: See TracTickets for help on using tickets.