From 3b8b95a22f6dd79a697536de851eb8ebb3997c1a Mon Sep 17 00:00:00 2001 From: catsout <36527596+catsout@users.noreply.github.com> Date: Mon, 25 Jul 2022 18:08:10 +0800 Subject: [PATCH] fix: Add Config/DataHomeDir paths before Config/DataDirs paths (#586) fix not saving to "XDG_DATA_HOME", when "XDG_DATA_DIRS" is available. fix "Content Store" persist in flatpak. XDG specification specifies how to find config and data directories on linux systems. Specifically, it says this: - Data should be written to $XDG_DATA_HOME - Config should be written to $XDG_CONFIG_HOME - Data should be read from $XDG_DATA_HOME:$XDG_DATA_DIRS - Config should be read from $XDG_CONFIG_HOME:$XDG_CONFIG_DIRS --- lib/libimhex/source/helpers/fs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libimhex/source/helpers/fs.cpp b/lib/libimhex/source/helpers/fs.cpp index 6fa817aa1..392237af2 100644 --- a/lib/libimhex/source/helpers/fs.cpp +++ b/lib/libimhex/source/helpers/fs.cpp @@ -247,8 +247,8 @@ namespace hex::fs { std::vector configDirs = xdg::ConfigDirs(); std::vector dataDirs = xdg::DataDirs(); - configDirs.push_back(xdg::ConfigHomeDir()); - dataDirs.push_back(xdg::DataHomeDir()); + configDirs.insert(configDirs.begin(), xdg::ConfigHomeDir()); + dataDirs.insert(dataDirs.begin(), xdg::DataHomeDir()); for (auto &dir : dataDirs) dir = dir / "imhex";