diff --git a/AUTHORS b/AUTHORS index 1e8f67870..3899ced2a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -28,6 +28,10 @@ Chen, Mike Coalson, Josh * support for libFLAC 1.1.3 +Domínguez, Cosme + * Fixed mmg's configuration location to conform to the XDG Base + Directory Specification + Duret, Xavier * Bugfix for timecode and default duration calculation for MPEG-1/2 tracks * 'Interlaced' header flag for interlaced MPEG-1/2 tracks diff --git a/ChangeLog b/ChangeLog index d2fe66843..b3240f2f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-09-05 Cosme Domínguez + + * 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 * all: Added an Lithuanian translation by Mindaugas Baranauskas diff --git a/src/common/fs_sys_helpers.cpp b/src/common/fs_sys_helpers.cpp index 88bf01244..2557233f7 100644 --- a/src/common/fs_sys_helpers.cpp +++ b/src/common/fs_sys_helpers.cpp @@ -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