Author: sayer
Date: 2009-01-20 17:46:17 +0100 (Tue, 20 Jan 2009)
New Revision: 1234

Modified:
   trunk/core/AmConfigReader.cpp
   trunk/core/etc/sems.conf.sample
   trunk/core/sems.h
Log:
fixed including config files' path

Modified: trunk/core/AmConfigReader.cpp
===================================================================
--- trunk/core/AmConfigReader.cpp       2009-01-20 16:30:38 UTC (rev 1233)
+++ trunk/core/AmConfigReader.cpp       2009-01-20 16:46:17 UTC (rev 1234)
@@ -72,8 +72,10 @@
        inc_beg = c++;
        while( !IS_EOL(*c) && !IS_SPACE(*c) ) c++;
        inc_end = c;
-       if(loadFile(AmConfig::ModConfigPath +
-                   string(inc_beg,inc_end-inc_beg) ))
+       string fname = string(inc_beg,inc_end-inc_beg);
+       if (fname.length() && fname[0] != '/')
+         fname = AmConfig::ModConfigPath + fname;
+       if(loadFile(fname))
            return -1;
        continue;
     }
@@ -114,15 +116,20 @@
 
     if((key_beg < key_end) && (val_beg <= val_end)) {
       string keyname = string(key_beg,key_end-key_beg);
+      string val = string(val_beg,val_end-val_beg);
       if (hasParameter(keyname)) {
        WARN("while loading '%s': overwriting configuration "
             "'%s' value '%s' with  '%s'\n",
             path.c_str(), keyname.c_str(), 
-            getParameter(keyname).c_str(), 
-            string(val_beg,val_end-val_beg).c_str());
+            getParameter(keyname).c_str(), val.c_str());
       }
-      keys[keyname] = 
-       string(val_beg,val_end-val_beg);
+
+      keys[keyname] = val;
+
+      // small hack to make include work with right path
+      if (keyname == "plugin_config_path")
+       AmConfig::ModConfigPath = val;
+
     } else
       goto syntax_error;
   }

Modified: trunk/core/etc/sems.conf.sample
===================================================================
--- trunk/core/etc/sems.conf.sample     2009-01-20 16:30:38 UTC (rev 1233)
+++ trunk/core/etc/sems.conf.sample     2009-01-20 16:46:17 UTC (rev 1234)
@@ -12,6 +12,8 @@
 # 
 # example: option=value # i like this option
 #
+# @filename includes mod_config_path/filename
+# @/absolute/path/to/file includes file
 
 ############################################################
 # Network configuration

Modified: trunk/core/sems.h
===================================================================
--- trunk/core/sems.h   2009-01-20 16:30:38 UTC (rev 1233)
+++ trunk/core/sems.h   2009-01-20 16:46:17 UTC (rev 1234)
@@ -33,7 +33,7 @@
 #endif
 
 #define CONFIG_FILE         "/usr/local/etc/sems/sems.conf"
-#define MOD_CFG_PATH        "/usr/local/etc/sems/etc"
+#define MOD_CFG_PATH        "/usr/local/etc/sems/etc/"
 #define SER_FIFO            "/tmp/ser_fifo"
 #define FIFO_NAME           "/tmp/am_fifo"
 #define SEND_METHOD         "unix"

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to