Update of /cvsroot/mahogany/M/src/classes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10401/src/classes

Modified Files:
        ConfigSource.cpp 
Log Message:
use UserDir as base for relative config file paths

Index: ConfigSource.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/classes/ConfigSource.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -b -u -2 -r1.18 -r1.19
--- ConfigSource.cpp    5 Jul 2005 21:23:08 -0000       1.18
+++ ConfigSource.cpp    6 Jul 2005 11:26:21 -0000       1.19
@@ -40,4 +40,5 @@
 
 #include <wx/dir.h>
+#include <wx/filename.h>
 #include <wx/fileconf.h>               // for wxFileConfig
 
@@ -531,9 +532,26 @@
                _T("invalid local config file path") );
 
+   // make the file name absolute if it isn't already or, if it is, remember
+   // its path to use it as base for the other config files (we can't use
+   // MAppBase::GetLocalDir() here as it isn't set yet)
+   static String s_pathConfigFiles;
+
+   wxFileName fn(localFilePath);
+   if ( fn.IsAbsolute() )
+   {
+      if ( s_pathConfigFiles.empty() )
+         s_pathConfigFiles = fn.GetPath();
+   }
+   else // relative path
+   {
+      if ( !s_pathConfigFiles.empty() )
+         fn.MakeAbsolute(s_pathConfigFiles);
+   }
+
    wxFileConfig *fileconf = new wxFileConfig
                                 (
                                     M_APPLICATIONNAME,
                                     M_VENDORNAME,
-                                    localFilePath,
+                                    fn.GetFullPath(),
                                     globalFilePath,
                                     wxCONFIG_USE_LOCAL_FILE |



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to