]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fileconf.cpp
Maybe negative wxWindowId are better than just -1.
[wxWidgets.git] / src / common / fileconf.cpp
index af6e490dcabe9741196e0ad0cea2c733d2c19d91..b41119bb0aaafdcf9e2285aa9c5332d5d04e6614 100644 (file)
@@ -226,18 +226,21 @@ wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName,
     SetStyle(GetStyle() | wxCONFIG_USE_GLOBAL_FILE);
 
   // if the path is not absolute, prepend the standard directory to it
-  if ( !m_strLocalFile.IsEmpty() && !wxIsAbsolutePath(m_strLocalFile) )
-  {
-    wxString strLocal = m_strLocalFile;
-    m_strLocalFile = GetLocalDir();
-    m_strLocalFile << strLocal;
-  }
-
-  if ( !m_strGlobalFile.IsEmpty() && !wxIsAbsolutePath(m_strGlobalFile) )
-  {
-    wxString strGlobal = m_strGlobalFile;
-    m_strGlobalFile = GetGlobalDir();
-    m_strGlobalFile << strGlobal;
+  // UNLESS wxCONFIG_USE_RELATIVE_PATH style is set
+  if ( !(style & wxCONFIG_USE_RELATIVE_PATH) ){
+         if ( !m_strLocalFile.IsEmpty() && !wxIsAbsolutePath(m_strLocalFile) )
+         {
+                 wxString strLocal = m_strLocalFile;
+                 m_strLocalFile = GetLocalDir();
+                 m_strLocalFile << strLocal;
+         }
+
+         if ( !m_strGlobalFile.IsEmpty() && !wxIsAbsolutePath(m_strGlobalFile) )
+         {
+                 wxString strGlobal = m_strGlobalFile;
+                 m_strGlobalFile = GetGlobalDir();
+                 m_strGlobalFile << strGlobal;
+         }
   }
 
   Init();
@@ -338,7 +341,7 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal)
     }
     else {                        // a key
       const wxChar *pEnd = pStart;
-      while ( !wxIsspace(*pEnd) ) {
+      while ( *pEnd != _T('=') && !wxIsspace(*pEnd) ) {
         if ( *pEnd == _T('\\') ) {
           // next character may be space or not - still take it because it's
           // quoted
@@ -610,8 +613,6 @@ bool wxFileConfig::Write(const wxString& key, const wxString& szValue)
       return FALSE;
     }
 
-    strName = FilterOutEntryName(strName);
-
     ConfigEntry *pEntry = m_pCurrentGroup->FindEntry(strName);
     if ( pEntry == NULL )
       pEntry = m_pCurrentGroup->AddEntry(strName);
@@ -906,7 +907,10 @@ LineList *ConfigGroup::GetGroupLine()
     // this group wasn't present in local config file, add it now
     if ( pParent != NULL ) {
       wxString strFullName;
-      strFullName << _T("[") << (GetFullName().c_str() + 1) << _T("]"); // +1: no '/'
+      strFullName << _T("[")
+                  // +1: no '/'
+                  << FilterOutEntryName(GetFullName().c_str() + 1)
+                  << _T("]");
       m_pLine = m_pConfig->LineListInsert(strFullName,
                                           pParent->GetLastGroupLine());
       pParent->SetLastGroup(this);  // we're surely after all the others
@@ -1273,7 +1277,7 @@ void ConfigEntry::SetValue(const wxString& strValue, bool bUser)
   if ( bUser ) {
     wxString strVal = FilterOutValue(strValue);
     wxString strLine;
-    strLine << m_strName << _T(" = ") << strVal;
+    strLine << FilterOutEntryName(m_strName) << _T('=') << strVal;
 
     if ( m_pLine != NULL ) {
       // entry was read from the local config file, just modify the line