nemuTUI / nemu

Ncurses UI for QEMU
BSD 2-Clause "Simplified" License
317 stars 22 forks source link

nemu doesn't follow XDG Base Directory Specification #95

Closed ligurio closed 2 years ago

ligurio commented 2 years ago

By default, nemu suggest creating configuration file in a home dir:

sergeyb@pony:~$ echo $XDG_CONFIG_HOME

sergeyb@pony:~/sources/MRG/expirationd$ nemu 
Config file "/home/sergeyb/.nemu.cfg" is not found.
You can copy example from:
/usr/share/nemu/templates/config/nemu.cfg.sample
and edit it manually or let the program generate it.

Generate cfg? (y/n)
> y
VM storage directory [default: /home/sergeyb/nemu_vm]
> 

But according to XDG Base Directory Specification [1] it should be $HOME/.config:

$XDG_CONFIG_HOME defines the base directory relative to which user-specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

  1. https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
  2. https://unix.stackexchange.com/posts/313001/revisions
grafin commented 2 years ago

Yeah, there is such problem. I've kinda fixed it in 445b5ecd. Default value can be set with -DNM_CFG_NAME=".config/nemu/nemu.cfg" in cmake. But I was not confident enough to change previous default behaviour, because it will break previous installations of nemu (it will not find previous config file). There is a simple fix - we can move the file automatically if it is located in ~/.nemu.cfg. @0x501D - do you approve changing default config path to ".config/nemu/nemu.cfg"?

Same question can be asked about VM storage directory and DB path (according to XDG Base Directory Specification it should be something like $HOME/.local/share/nemu/vms and $HOME/.local/share/nemu/nemu.db). But those paths are configured in nemu.cfg and don't need to be moved automatically.

0x501D commented 2 years ago

LGTM. Lets fix this.