diff mde/resource/paths.d @ 24:32eff0e01c05

Only locally-changed options are stored in user-config now. Log levels revised. Options sub-classes are handled more generically and can be added without changing the Options class. Options changed at run-time are tracked, and on exit merged with user options and saved. Revised log levels as set out in policies.txt and as used in code. committer: Diggory Hardy <diggory.hardy@gmail.com>
author Diggory Hardy <diggory.hardy@gmail.com>
date Thu, 27 Mar 2008 16:15:21 +0000
parents 56a42ec95024
children 611f7b9063c6
line wrap: on
line diff
--- a/mde/resource/paths.d	Thu Mar 27 10:58:57 2008 +0000
+++ b/mde/resource/paths.d	Thu Mar 27 16:15:21 2008 +0000
@@ -49,7 +49,9 @@
 
 /** This struct has one instance for each "directory".
 *
-* It is the only item within this module that you should need to interact with. */
+* It is the only item within this module that you should need to interact with.
+*
+* In the case of confDir, the user path is guaranteed to exist (as highest priority path). */
 struct mdeDirectory
 {
     /** Creates an MT reader for each file.
@@ -114,8 +116,8 @@
                 paths[pathsLen++] = fp.toString~'/';
                 return true;
             } catch (Exception e) {
-                logger.warn ("Creating path "~path~" failed:");
-                logger.warn (e.msg);
+                logger.error ("Creating path "~path~" failed:");
+                logger.error (e.msg);
             }
         }
         return false;
@@ -142,31 +144,26 @@
 
 version (linux) {
     void resolvePaths () {
-        logger.trace ("1");
         // Home directory:
         char[] HOME = fromStringz (getenv (toStringz ("HOME")));
         
-        logger.trace ("3");
         // Base paths:
         // Static data (must exist):
         PathView staticPath = findPath (false, "/usr/share/games/mde", "/usr/local/share/games/mde", "data");
         // Config (can just use defaults if necessary, so long as we can save afterwards):
         PathView userPath = findPath (true, HOME~"/.config/mde", HOME~"/.mde");
         
-        logger.trace ("5");
         // Static data paths:
         dataDir.addPath (staticPath.toString);      // we know this is valid anyway
         dataDir.tryPath (userPath.toString ~ DATA);
         if (!dataDir.pathsLen) throw new mdeException ("Fatal: no data path found!");
         
-        logger.trace ("7");
         // Configuration paths:
         confDir.tryPath (staticPath.toString ~ CONF);
-        bool sysConf = confDir.tryPath ("/etc/mde");
-        confDir.tryPath (userPath.toString ~ CONF, !sysConf);
+        confDir.tryPath ("/etc/mde");
+        confDir.tryPath (userPath.toString ~ CONF, true);
         if (!confDir.pathsLen) throw new mdeException ("Fatal: no conf path found!");
         
-        logger.trace ("9");
         // Logging path:
         logDir = userPath.toString;
     }