Skip to content

Patch for database location bug #269

@OldCoder

Description

@OldCoder

I've added Dooble to my Linux distro [Laclin]. I've noticed a minor bug and I'd like to suggest a patch. The patch might not be correct in all cases, but it'll help to indicate the issue.

The issue is that Dooble settings code is called, and relies on a setting named "home_path", before "home_path" is set. The net result is that an initial copy of a settings database file is stored, incorrectly, in the system's top-level directory. The patch that I'm presently using is as follows. It's been tested under Linux. It may or may not be appropriate for Windows.

--- dooble-git-5ac996ba9.old/Source/dooble_settings.cc
+++ dooble-git-5ac996ba9/Source/dooble_settings.cc
@@ -582,7 +581,19 @@
 
   if(!s_settings.contains(key))
     {
-      auto const home_path = s_settings.value("home_path").toString();
+      auto home_path = s_settings.value("home_path").toString();
+
+      if (home_path.isEmpty())
+      {
+          auto const hobytes (qEnvironmentVariable \
+("DOOBLE_HOME").trimmed());    
+
+          if (!hobytes.isEmpty())
+          {
+              QDir().mkpath (hobytes);
+              home_path = hobytes;
+          }
+      }
 
       locker.unlock();
 
==== end of patch ====

Note: I've posted an initial review of Dooble at the following link. This post was, of course, itself submitted using Dooble.

https://dansu.org/@OldCoder/posts/B0IOWFB1prrfa6hwBc

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions