Modify

Opened 22 months ago

Last modified 16 months ago

#6664 new enhancement

Josm config files should be in $XDG_CONFIG_HOME instead of ~/.josm

Reported by: anonymous Owned by: team
Priority: normal Component: Core
Version: Keywords:
Cc:

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.

Attachments (0)

Change History (7)

comment:1 follow-up: Changed 22 months ago by olejorgenb

A workaround is to run josm as:

APPDATA=$XDG_CONFIG_HOME java -jar josm.jar

comment:2 follow-up: Changed 22 months ago by bastiK

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.

comment:3 in reply to: ↑ 1 Changed 22 months ago by bastiK

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.

comment:4 in reply to: ↑ 2 Changed 22 months ago by anonymous

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 Changed 21 months ago by bastiK

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 Changed 21 months ago by bastiK

  • Type changed from defect to enhancement

comment:7 Changed 16 months ago by bastiK

  • 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 16 months ago by bastiK (previous) (diff)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as new .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team. Next status will be 'new'.
Next status will be 'needinfo'.The owner will change to anonymous
as duplicate The resolution will be set to duplicate. Next status will be 'closed'.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous. Next status will be 'assigned'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.