1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 20:10:29 +01:00

WMaker: Store history in $XDG_STATE_HOME if defined

The FreeDesktop XDG standard suggests storing history in the directory
pointed by $XDG_STATE_HOME; so if we find it is defined we prefer to use
it over the default path. If undefined, keep the old behaviour.

This may introduce a loss of history for users that had some in the legacy
place but have the variable, we consider this very unlikely to be a problem
but if user complains we can suggest them to move the legacy file over the
empty new one.
This commit is contained in:
John D Pell
2021-08-08 09:36:22 +02:00
committed by Carlos R. Mafra
parent 9f9ef6417e
commit 85169642ca

View File

@@ -182,8 +182,12 @@ static char *HistoryFileName(const char *name)
{
char *filename = NULL;
filename = wstrdup(wusergnusteppath());
filename = wstrappend(filename, "/.AppInfo/WindowMaker/History");
filename = getenv("XDG_STATE_HOME");
if (filename)
filename = wstrappend(wexpandpath(filename), "/" PACKAGE_TARNAME "/History");
else
filename = wstrconcat(wusergnusteppath(), "/.AppInfo/" PACKAGE_TARNAME "/History");
if (name && strlen(name)) {
filename = wstrappend(filename, ".");
filename = wstrappend(filename, name);