$OpenBSD: patch-source_exhumed_src_exhumed_cpp,v 1.3 2020/03/14 06:15:15 jsg Exp $

store log file in ~/.config/pcexhumed/

Index: source/exhumed/src/exhumed.cpp
--- source/exhumed/src/exhumed.cpp.orig
+++ source/exhumed/src/exhumed.cpp
@@ -2228,6 +2228,9 @@ static int32_t nonsharedtimer;
 int app_main(int argc, char const* const* argv)
 {
     char tempbuf[256];
+    char logpath[BMAX_PATH];
+    char *homedir;
+    int r;
 #ifdef _WIN32
 #ifndef DEBUGGINGAIDS
     if (!G_CheckCmdSwitch(argc, argv, "-noinstancechecking") && !windowsCheckAlreadyRunning())
@@ -2252,7 +2255,22 @@ int app_main(int argc, char const* const* argv)
 
     G_ExtPreInit(argc, argv);
 
-    OSD_SetLogFile(APPBASENAME ".log");
+    homedir = Bgethomedir();
+    if (!g_useCwd && homedir != NULL)
+    {
+        Bsnprintf(logpath, sizeof(logpath), "%s/.config/%s", homedir, APPBASENAME);
+        r = Bmkdir(logpath, S_IRWXU);
+        if (r == 0 || (r == -1 && errno == EEXIST))
+        {
+            Bsnprintf(logpath, sizeof(logpath), "%s/.config/%s/%s.log", homedir, APPBASENAME, APPBASENAME);
+            OSD_SetLogFile(logpath);
+        }
+        else
+            OSD_SetLogFile(APPBASENAME ".log");
+    }
+    else
+        OSD_SetLogFile(APPBASENAME ".log");
+    Bfree(homedir);
 
     OSD_SetFunctions(NULL,
                      NULL,
