Follow XDG Base Diretcory Specification for mmg's configuration files

Fix for bug 657.
This commit is contained in:
Cosme Domínguez 2011-09-05 23:40:58 +02:00 committed by Moritz Bunkus
parent 105f959024
commit 6ccb960cc5
3 changed files with 24 additions and 1 deletions

View File

@ -28,6 +28,10 @@ Chen, Mike <mike.chen82@googlemail.com>
Coalson, Josh <j_coalson@yahoo.com>
* support for libFLAC 1.1.3
Domínguez, Cosme <cosme.ddiaz@gmail.com>
* Fixed mmg's configuration location to conform to the XDG Base
Directory Specification
Duret, Xavier <xaviour.maillists@gmail.com>
* Bugfix for timecode and default duration calculation for MPEG-1/2 tracks
* 'Interlaced' header flag for interlaced MPEG-1/2 tracks

View File

@ -1,3 +1,10 @@
2011-09-05 Cosme Domínguez <cosme.ddiaz@gmail.com>
* mmg: mmg respects the XDG Base Directory Specification regarding
its configuration files (environment variable
$XDG_CONFIG_HOME/mkvtoolnix if set, otherwise
~/.config/mkvtoolnix).
2011-08-24 Moritz Bunkus <moritz@bunkus.org>
* all: Added an Lithuanian translation by Mindaugas Baranauskas

View File

@ -206,7 +206,19 @@ get_application_data_folder() {
if (NULL == home)
return "";
return std::string(home) + "/.mkvtoolnix";
// If $HOME/.mkvtoolnix exists already then keep using it to avoid
// losing existing user configuration.
std::string old_default_folder = std::string(home) + "/.mkvtoolnix";
if (fs_entry_exists(old_default_folder.c_str()))
return old_default_folder;
// If XDG_CONFIG_HOME is set then use that folder.
const char *xdg_config_home = getenv("XDG_CONFIG_HOME");
if (NULL != xdg_config_home)
return std::string(xdg_config_home) + "/mkvtoolnix";
// If all fails then use the XDG fallback folder for config files.
return std::string(home) + "/.config/mkvtoolnix";
}
std::string