+ wxLogWarning(_("can't open user configuration file '%s'."),
+ m_strLocalFile.c_str());
+ }
+}
+
+// constructor supports creation of wxFileConfig objects of any type
+wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName,
+ const wxString& strLocal, const wxString& strGlobal,
+ long style)
+ : wxConfigBase(::GetAppName(appName), vendorName,
+ strLocal, strGlobal,
+ style),
+ m_strLocalFile(strLocal), m_strGlobalFile(strGlobal)
+{
+ // Make up names for files if empty
+ if ( m_strLocalFile.IsEmpty() && (style & wxCONFIG_USE_LOCAL_FILE) )
+ {
+ m_strLocalFile = GetLocalFileName(GetAppName());
+ }
+
+ if ( m_strGlobalFile.IsEmpty() && (style & wxCONFIG_USE_GLOBAL_FILE) )
+ {
+ m_strGlobalFile = GetGlobalFileName(GetAppName());
+ }
+
+ // Check if styles are not supplied, but filenames are, in which case
+ // add the correct styles.
+ if ( !m_strLocalFile.IsEmpty() )
+ SetStyle(GetStyle() | wxCONFIG_USE_LOCAL_FILE);
+
+ if ( !m_strGlobalFile.IsEmpty() )
+ SetStyle(GetStyle() | wxCONFIG_USE_GLOBAL_FILE);
+
+ // if the path is not absolute, prepend the standard directory to it
+ // 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();
+}
+
+void wxFileConfig::CleanUp()
+{
+ delete m_pRootGroup;
+
+ LineList *pCur = m_linesHead;
+ while ( pCur != NULL ) {
+ LineList *pNext = pCur->Next();
+ delete pCur;
+ pCur = pNext;