From f6742d8fb4422e894d248d20943085fce53e5c89 Mon Sep 17 00:00:00 2001 From: fenuks Date: Mon, 1 Nov 2021 11:20:15 +0100 Subject: [PATCH] Linux-specific: Optionally use XDG_CONFIG_HOME for config in Qt5 build --- config.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config.cc b/config.cc index e641e783..9e7a129c 100644 --- a/config.cc +++ b/config.cc @@ -52,6 +52,14 @@ namespace result = QDir::fromNativeSeparators( QString::fromWCharArray( _wgetenv( L"APPDATA" ) ) ); #else char const * pathInHome = ".goldendict"; + #if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) && defined( HAVE_X11 ) + // check if an old config dir is present, otherwise use standards-compliant location + if ( !result.exists( pathInHome ) ) + { + result.setPath( QStandardPaths::writableLocation( QStandardPaths::ConfigLocation ) ); + pathInHome = "goldendict"; + } + #endif #endif result.mkpath( pathInHome );