]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fileconf.cpp
Support encodings in wxGTK_CONV_BACK() in the same way as we do it in
[wxWidgets.git] / src / common / fileconf.cpp
index c8688763011806944c34b6e6f1fcc996a989d5dc..6352e8cdfbcefa5bb512c93780a51310783b23ff 100644 (file)
@@ -439,7 +439,7 @@ wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName,
         m_strLocalFile = GetLocalFileName(GetAppName());
 #if defined(__UNIX__) && !defined(__VMS)
         if ( style & wxCONFIG_USE_SUBDIR )
-            m_strLocalFile << wxFILE_SEP_PATH << GetAppName();
+            m_strLocalFile << wxFILE_SEP_PATH << GetAppName() << _T(".conf");
 #endif
     }
 
@@ -1047,15 +1047,17 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
   }
 
   // write all strings to file
+  wxString filetext;
+  filetext.reserve(4096);
   for ( wxFileConfigLineList *p = m_linesHead; p != NULL; p = p->Next() )
   {
-    wxString line = p->Text();
-    line += wxTextFile::GetEOL();
-    if ( !file.Write(line, *m_conv) )
-    {
-      wxLogError(_("can't write user configuration file."));
-      return false;
-    }
+    filetext << p->Text() << wxTextFile::GetEOL();
+  }
+
+  if ( !file.Write(filetext, *m_conv) )
+  {
+    wxLogError(_("can't write user configuration file."));
+    return false;
   }
 
   if ( !file.Commit() )