Skip to content

Commit aa92bb1

Browse files
authored
Merge pull request gridcoin-community#2774 from div72/flatpak-datadir
util: use XDG_STATE_HOME for datadir on Flatpak
2 parents 4ae471e + 4d9ebde commit aa92bb1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/util/system.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,19 @@ fs::path GetDefaultDataDir()
772772
} else {
773773
pathRet = fs::path(pszHome);
774774
}
775+
776+
char* container = getenv("container");
777+
778+
if (container && strcmp(container, "flatpak") == 0) {
779+
char* state_home = getenv("XDG_STATE_HOME");
780+
781+
if (!state_home) {
782+
return pathRet / ".local" / "state" / "GridcoinResearch";
783+
}
784+
785+
return fs::path(state_home) / "GridcoinResearch";
786+
}
787+
775788
#ifdef MAC_OSX
776789
// The pathRet here represents the HOME directory. Apple
777790
// applications are expected to store their files in

0 commit comments

Comments
 (0)