Skip to content

Commit

Permalink
Merge pull request #2774 from div72/flatpak-datadir
Browse files Browse the repository at this point in the history
util: use XDG_STATE_HOME for datadir on Flatpak
  • Loading branch information
jamescowens authored Sep 6, 2024
2 parents 4ae471e + 4d9ebde commit aa92bb1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/util/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,19 @@ fs::path GetDefaultDataDir()
} else {
pathRet = fs::path(pszHome);
}

char* container = getenv("container");

if (container && strcmp(container, "flatpak") == 0) {
char* state_home = getenv("XDG_STATE_HOME");

if (!state_home) {
return pathRet / ".local" / "state" / "GridcoinResearch";
}

return fs::path(state_home) / "GridcoinResearch";
}

#ifdef MAC_OSX
// The pathRet here represents the HOME directory. Apple
// applications are expected to store their files in
Expand Down

0 comments on commit aa92bb1

Please sign in to comment.