X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9869734d0431a29732006119f2d4ed35af70ca9b..06b466c74fae8f27544f143abdcabcd2385602e4:/src/common/fileconf.cpp diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index cc1567b4ee..1ee849986d 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -14,19 +14,18 @@ #pragma implementation "fileconf.h" #endif -// ============================================================================ -// declarations -// ============================================================================ - // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- + #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //__BORLANDC__ +#if wxUSE_CONFIG + #ifndef WX_PRECOMP #include "wx/string.h" #include "wx/intl.h" @@ -47,6 +46,10 @@ #if defined(__WXMSW__) && !defined(_WINDOWS_) #include #endif //windows.h +#if defined(__WXPM__) + #define INCL_DOS + #include +#endif #include #include @@ -68,8 +71,8 @@ // ---------------------------------------------------------------------------- // compare functions for sorting the arrays -static int CompareEntries(ConfigEntry *p1, ConfigEntry *p2); -static int CompareGroups(ConfigGroup *p1, ConfigGroup *p2); +static int LINKAGEMODE CompareEntries(ConfigEntry *p1, ConfigEntry *p2); +static int LINKAGEMODE CompareGroups(ConfigGroup *p1, ConfigGroup *p2); // filter strings static wxString FilterInValue(const wxString& str); @@ -78,6 +81,9 @@ static wxString FilterOutValue(const wxString& str); static wxString FilterInEntryName(const wxString& str); static wxString FilterOutEntryName(const wxString& str); +// get the name to use in wxFileConfig ctor +static wxString GetAppName(const wxString& appname); + // ============================================================================ // implementation // ============================================================================ @@ -89,18 +95,123 @@ wxString wxFileConfig::GetGlobalDir() { wxString strDir; - #ifdef __UNIX__ - strDir = "/etc/"; + #ifdef __VMS__ // Note if __VMS is defined __UNIX is also defined + strDir = wxT("sys$manager:"); + #elif defined( __UNIX__ ) + strDir = wxT("/etc/"); + #elif defined(__WXPM__) + ULONG aulSysInfo[QSV_MAX] = {0}; + UINT drive; + APIRET rc; + + rc = DosQuerySysInfo( 1L, QSV_MAX, (PVOID)aulSysInfo, sizeof(ULONG)*QSV_MAX); + if (rc == 0) + { + drive = aulSysInfo[QSV_BOOT_DRIVE - 1]; + switch(drive) + { + case 1: + strDir = "A:\\OS2\\"; + break; + case 2: + strDir = "B:\\OS2\\"; + break; + case 3: + strDir = "C:\\OS2\\"; + break; + case 4: + strDir = "D:\\OS2\\"; + break; + case 5: + strDir = "E:\\OS2\\"; + break; + case 6: + strDir = "F:\\OS2\\"; + break; + case 7: + strDir = "G:\\OS2\\"; + break; + case 8: + strDir = "H:\\OS2\\"; + break; + case 9: + strDir = "I:\\OS2\\"; + break; + case 10: + strDir = "J:\\OS2\\"; + break; + case 11: + strDir = "K:\\OS2\\"; + break; + case 12: + strDir = "L:\\OS2\\"; + break; + case 13: + strDir = "M:\\OS2\\"; + break; + case 14: + strDir = "N:\\OS2\\"; + break; + case 15: + strDir = "O:\\OS2\\"; + break; + case 16: + strDir = "P:\\OS2\\"; + break; + case 17: + strDir = "Q:\\OS2\\"; + break; + case 18: + strDir = "R:\\OS2\\"; + break; + case 19: + strDir = "S:\\OS2\\"; + break; + case 20: + strDir = "T:\\OS2\\"; + break; + case 21: + strDir = "U:\\OS2\\"; + break; + case 22: + strDir = "V:\\OS2\\"; + break; + case 23: + strDir = "W:\\OS2\\"; + break; + case 24: + strDir = "X:\\OS2\\"; + break; + case 25: + strDir = "Y:\\OS2\\"; + break; + case 26: + strDir = "Z:\\OS2\\"; + break; + } + } #elif defined(__WXSTUBS__) - wxASSERT_MSG( FALSE, "TODO" ) ; + wxASSERT_MSG( FALSE, wxT("TODO") ) ; #elif defined(__WXMAC__) - wxASSERT_MSG( FALSE, "TODO" ) ; + { + short vRefNum ; + long dirID ; + + if ( FindFolder( (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder, &vRefNum, &dirID) == noErr) + { + FSSpec file ; + if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr ) + { + strDir = wxMacFSSpec2UnixFilename( &file ) + "/" ; + } + } + } #else // Windows - char szWinDir[MAX_PATH]; + wxChar szWinDir[MAX_PATH]; ::GetWindowsDirectory(szWinDir, MAX_PATH); strDir = szWinDir; - strDir << '\\'; + strDir << wxT('\\'); #endif // Unix/Windows return strDir; @@ -110,47 +221,66 @@ wxString wxFileConfig::GetLocalDir() { wxString strDir; +#ifndef __WXMAC__ wxGetHomeDir(&strDir); -#ifdef __UNIX__ - if (strDir.Last() != '/') strDir << '/'; +#ifndef __VMS__ +# ifdef __UNIX__ + if (strDir.Last() != wxT('/')) strDir << wxT('/'); +#else + if (strDir.Last() != wxT('\\')) strDir << wxT('\\'); +#endif +#endif #else - if (strDir.Last() != '\\') strDir << '\\'; + // no local dir concept on mac + return GetGlobalDir() ; #endif return strDir; } -wxString wxFileConfig::GetGlobalFileName(const char *szFile) +wxString wxFileConfig::GetGlobalFileName(const wxChar *szFile) { wxString str = GetGlobalDir(); str << szFile; - if ( strchr(szFile, '.') == NULL ) + if ( wxStrchr(szFile, wxT('.')) == NULL ) #ifdef __UNIX__ - str << ".conf"; + str << wxT(".conf"); + #elif defined( __WXMAC__ ) + str << " Preferences"; #else // Windows - str << ".ini"; + str << wxT(".ini"); #endif // UNIX/Win return str; } -wxString wxFileConfig::GetLocalFileName(const char *szFile) +wxString wxFileConfig::GetLocalFileName(const wxChar *szFile) { - wxString str = GetLocalDir(); - +#ifdef __VMS__ // On VMS I saw the problem that the home directory was appended + // twice for the configuration file. Does that also happen for other + // platforms? + wxString str = wxT( ' ' ); +#else + wxString str = GetLocalDir(); +#endif + #ifdef __UNIX__ - str << '.'; + str << wxT('.'); #endif str << szFile; #ifdef __WXMSW__ - if ( strchr(szFile, '.') == NULL ) - str << ".ini"; + if ( wxStrchr(szFile, wxT('.')) == NULL ) + str << wxT(".ini"); #endif + + #ifdef __WXMAC__ + str << " Preferences"; + #endif return str; } @@ -198,9 +328,9 @@ void wxFileConfig::Init() wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName, const wxString& strLocal, const wxString& strGlobal, long style) - : wxConfigBase(!appName && wxTheApp ? wxTheApp->GetAppName() - : appName, - vendorName, strLocal, strGlobal, style), + : wxConfigBase(::GetAppName(appName), vendorName, + strLocal, strGlobal, + style), m_strLocalFile(strLocal), m_strGlobalFile(strGlobal) { // Make up names for files if empty @@ -223,18 +353,22 @@ 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) ) + // UNLESS wxCONFIG_USE_RELATIVE_PATH style is set + if ( !(style & wxCONFIG_USE_RELATIVE_PATH) ) { - wxString strLocal = m_strLocalFile; - m_strLocalFile = GetLocalDir(); - m_strLocalFile << strLocal; - } + 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; + if ( !m_strGlobalFile.IsEmpty() && !wxIsAbsolutePath(m_strGlobalFile) ) + { + wxString strGlobal = m_strGlobalFile; + m_strGlobalFile = GetGlobalDir(); + m_strGlobalFile << strGlobal; + } } Init(); @@ -265,8 +399,8 @@ wxFileConfig::~wxFileConfig() void wxFileConfig::Parse(wxTextFile& file, bool bLocal) { - const char *pStart; - const char *pEnd; + const wxChar *pStart; + const wxChar *pEnd; wxString strLine; size_t nLineCount = file.GetLineCount(); @@ -278,22 +412,22 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal) LineListAppend(strLine); // skip leading spaces - for ( pStart = strLine; isspace(*pStart); pStart++ ) + for ( pStart = strLine; wxIsspace(*pStart); pStart++ ) ; // skip blank/comment lines - if ( *pStart == '\0'|| *pStart == ';' || *pStart == '#' ) + if ( *pStart == wxT('\0')|| *pStart == wxT(';') || *pStart == wxT('#') ) continue; - if ( *pStart == '[' ) { // a new group + if ( *pStart == wxT('[') ) { // a new group pEnd = pStart; - while ( *++pEnd != ']' ) { - if ( *pEnd == '\n' || *pEnd == '\0' ) + while ( *++pEnd != wxT(']') ) { + if ( *pEnd == wxT('\n') || *pEnd == wxT('\0') ) break; } - if ( *pEnd != ']' ) { + if ( *pEnd != wxT(']') ) { wxLogError(_("file '%s': unexpected character %c at line %d."), file.GetName(), *pEnd, n + 1); continue; // skip this line @@ -313,15 +447,15 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal) // check that there is nothing except comments left on this line bool bCont = TRUE; - while ( *++pEnd != '\0' && bCont ) { + while ( *++pEnd != wxT('\0') && bCont ) { switch ( *pEnd ) { - case '#': - case ';': + case wxT('#'): + case wxT(';'): bCont = FALSE; break; - case ' ': - case '\t': + case wxT(' '): + case wxT('\t'): // ignore whitespace ('\n' impossible here) break; @@ -334,24 +468,26 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal) } } else { // a key - const char *pEnd = pStart; - while ( !isspace(*pEnd) ) { - if ( *pEnd == '\\' ) { + size_t count = 0; + const wxChar *pEnd = pStart; + while ( *pEnd != wxT('=') && !wxIsspace(*pEnd) ) { + if ( *pEnd == wxT('\\') ) { // next character may be space or not - still take it because it's // quoted pEnd++; } + count++; pEnd++; } - wxString strKey(FilterInEntryName(wxString(pStart, pEnd))); + wxString strKey(FilterInEntryName(wxString(pStart, count))); // skip whitespace while ( isspace(*pEnd) ) pEnd++; - if ( *pEnd++ != '=' ) { + if ( *pEnd++ != wxT('=') ) { wxLogError(_("file '%s', line %d: '=' expected."), file.GetName(), n + 1); } @@ -389,7 +525,7 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal) } // skip whitespace - while ( isspace(*pEnd) ) + while ( wxIsspace(*pEnd) ) pEnd++; pEntry->SetValue(FilterInValue(pEnd), FALSE /* read from file */); @@ -458,7 +594,7 @@ bool wxFileConfig::GetFirstGroup(wxString& str, long& lIndex) const bool wxFileConfig::GetNextGroup (wxString& str, long& lIndex) const { if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) { - str = m_pCurrentGroup->Groups()[lIndex++]->Name(); + str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name(); return TRUE; } else @@ -474,7 +610,7 @@ bool wxFileConfig::GetFirstEntry(wxString& str, long& lIndex) const bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const { if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) { - str = m_pCurrentGroup->Entries()[lIndex++]->Name(); + str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name(); return TRUE; } else @@ -574,7 +710,7 @@ bool wxFileConfig::Read(const wxString& key, long *pl) const { wxString str; if ( Read(key, & str) ) { - *pl = atol(str); + *pl = wxAtol(str); return TRUE; } else { @@ -589,7 +725,7 @@ bool wxFileConfig::Write(const wxString& key, const wxString& szValue) wxString strName = path.Name(); if ( strName.IsEmpty() ) { // setting the value of a group is an error - wxASSERT_MSG( IsEmpty(szValue), "can't set value of a group!" ); + wxASSERT_MSG( wxIsEmpty(szValue), wxT("can't set value of a group!") ); // ... except if it's empty in which case it's a way to force it's creation m_pCurrentGroup->SetDirty(); @@ -607,8 +743,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); @@ -623,13 +757,13 @@ bool wxFileConfig::Write(const wxString& key, long lValue) { // ltoa() is not ANSI :-( wxString buf; - buf.Printf("%ld", lValue); + buf.Printf(wxT("%ld"), lValue); return Write(key, buf); } bool wxFileConfig::Flush(bool /* bCurrentOnly */) { - if ( LineListIsEmpty() || !m_pRootGroup->IsDirty() ) + if ( LineListIsEmpty() || !m_pRootGroup->IsDirty() || !m_strLocalFile ) return TRUE; wxTempFile file(m_strLocalFile); @@ -647,7 +781,25 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) } } +#ifndef __WXMAC__ return file.Commit(); +#else + bool ret = file.Commit(); + if ( ret ) + { + FSSpec spec ; + + wxUnixFilename2FSSpec( m_strLocalFile , &spec ) ; + FInfo finfo ; + if ( FSpGetFInfo( &spec , &finfo ) == noErr ) + { + finfo.fdType = 'TEXT' ; + finfo.fdCreator = 'ttxt' ; + FSpSetFInfo( &spec , &finfo ) ; + } + } + return ret ; +#endif } // ---------------------------------------------------------------------------- @@ -708,7 +860,7 @@ bool wxFileConfig::DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso) if ( bGroupIfEmptyAlso && m_pCurrentGroup->IsEmpty() ) { if ( m_pCurrentGroup != m_pRootGroup ) { ConfigGroup *pGroup = m_pCurrentGroup; - SetPath(".."); // changes m_pCurrentGroup! + SetPath(wxT("..")); // changes m_pCurrentGroup! m_pCurrentGroup->DeleteSubgroupByName(pGroup->Name()); } //else: never delete the root group @@ -728,12 +880,10 @@ bool wxFileConfig::DeleteAll() { CleanUp(); - const char *szFile = m_strLocalFile; + if ( remove(m_strLocalFile.fn_str()) == -1 ) + wxLogSysError(_("can't delete user configuration file '%s'"), m_strLocalFile.c_str()); - if ( remove(szFile) == -1 ) - wxLogSysError(_("can't delete user configuration file '%s'"), szFile); - - m_strLocalFile = m_strGlobalFile = ""; + m_strLocalFile = m_strGlobalFile = wxT(""); Init(); return TRUE; @@ -905,7 +1055,10 @@ LineList *ConfigGroup::GetGroupLine() // this group wasn't present in local config file, add it now if ( pParent != NULL ) { wxString strFullName; - strFullName << "[" << (GetFullName().c_str() + 1) << "]"; // +1: no '/' + strFullName << wxT("[") + // +1: no '/' + << FilterOutEntryName(GetFullName().c_str() + 1) + << wxT("]"); m_pLine = m_pConfig->LineListInsert(strFullName, pParent->GetLastGroupLine()); pParent->SetLastGroup(this); // we're surely after all the others @@ -963,7 +1116,7 @@ void ConfigGroup::Rename(const wxString& newName) LineList *line = GetGroupLine(); wxString strFullName; - strFullName << "[" << (GetFullName().c_str() + 1) << "]"; // +1: no '/' + strFullName << wxT("[") << (GetFullName().c_str() + 1) << wxT("]"); // +1: no '/' line->SetText(strFullName); SetDirty(); @@ -974,7 +1127,7 @@ wxString ConfigGroup::GetFullName() const if ( Parent() ) return Parent()->GetFullName() + wxCONFIG_PATH_SEPARATOR + Name(); else - return ""; + return wxT(""); } // ---------------------------------------------------------------------------- @@ -983,7 +1136,7 @@ wxString ConfigGroup::GetFullName() const // use binary search because the array is sorted ConfigEntry * -ConfigGroup::FindEntry(const char *szName) const +ConfigGroup::FindEntry(const wxChar *szName) const { size_t i, lo = 0, @@ -996,9 +1149,9 @@ ConfigGroup::FindEntry(const char *szName) const pEntry = m_aEntries[i]; #if wxCONFIG_CASE_SENSITIVE - res = strcmp(pEntry->Name(), szName); + res = wxStrcmp(pEntry->Name(), szName); #else - res = Stricmp(pEntry->Name(), szName); + res = wxStricmp(pEntry->Name(), szName); #endif if ( res > 0 ) @@ -1013,7 +1166,7 @@ ConfigGroup::FindEntry(const char *szName) const } ConfigGroup * -ConfigGroup::FindSubgroup(const char *szName) const +ConfigGroup::FindSubgroup(const wxChar *szName) const { size_t i, lo = 0, @@ -1026,9 +1179,9 @@ ConfigGroup::FindSubgroup(const char *szName) const pGroup = m_aSubgroups[i]; #if wxCONFIG_CASE_SENSITIVE - res = strcmp(pGroup->Name(), szName); + res = wxStrcmp(pGroup->Name(), szName); #else - res = Stricmp(pGroup->Name(), szName); + res = wxStricmp(pGroup->Name(), szName); #endif if ( res > 0 ) @@ -1081,7 +1234,7 @@ ConfigGroup::AddSubgroup(const wxString& strName) delete several of them. */ -bool ConfigGroup::DeleteSubgroupByName(const char *szName) +bool ConfigGroup::DeleteSubgroupByName(const wxChar *szName) { return DeleteSubgroup(FindSubgroup(szName)); } @@ -1153,7 +1306,7 @@ bool ConfigGroup::DeleteSubgroup(ConfigGroup *pGroup) return TRUE; } -bool ConfigGroup::DeleteEntry(const char *szName) +bool ConfigGroup::DeleteEntry(const wxChar *szName) { ConfigEntry *pEntry = FindEntry(szName); wxCHECK( pEntry != NULL, FALSE ); // deleting non existing item? @@ -1272,7 +1425,7 @@ void ConfigEntry::SetValue(const wxString& strValue, bool bUser) if ( bUser ) { wxString strVal = FilterOutValue(strValue); wxString strLine; - strLine << m_strName << " = " << strVal; + strLine << FilterOutEntryName(m_strName) << wxT('=') << strVal; if ( m_pLine != NULL ) { // entry was read from the local config file, just modify the line @@ -1309,9 +1462,9 @@ int CompareEntries(ConfigEntry *p1, ConfigEntry *p2) { #if wxCONFIG_CASE_SENSITIVE - return strcmp(p1->Name(), p2->Name()); + return wxStrcmp(p1->Name(), p2->Name()); #else - return Stricmp(p1->Name(), p2->Name()); + return wxStricmp(p1->Name(), p2->Name()); #endif } @@ -1319,9 +1472,9 @@ int CompareGroups(ConfigGroup *p1, ConfigGroup *p2) { #if wxCONFIG_CASE_SENSITIVE - return strcmp(p1->Name(), p2->Name()); + return wxStrcmp(p1->Name(), p2->Name()); #else - return Stricmp(p1->Name(), p2->Name()); + return wxStricmp(p1->Name(), p2->Name()); #endif } @@ -1338,31 +1491,31 @@ static wxString FilterInValue(const wxString& str) bool bQuoted = !str.IsEmpty() && str[0] == '"'; for ( size_t n = bQuoted ? 1 : 0; n < str.Len(); n++ ) { - if ( str[n] == '\\' ) { + if ( str[n] == wxT('\\') ) { switch ( str[++n] ) { - case 'n': - strResult += '\n'; + case wxT('n'): + strResult += wxT('\n'); break; - case 'r': - strResult += '\r'; + case wxT('r'): + strResult += wxT('\r'); break; - case 't': - strResult += '\t'; + case wxT('t'): + strResult += wxT('\t'); break; - case '\\': - strResult += '\\'; + case wxT('\\'): + strResult += wxT('\\'); break; - case '"': - strResult += '"'; + case wxT('"'): + strResult += wxT('"'); break; } } else { - if ( str[n] != '"' || !bQuoted ) + if ( str[n] != wxT('"') || !bQuoted ) strResult += str[n]; else if ( n != str.Len() - 1 ) { wxLogWarning(_("unexpected \" at position %d in '%s'."), @@ -1385,33 +1538,33 @@ static wxString FilterOutValue(const wxString& str) strResult.Alloc(str.Len()); // quoting is necessary to preserve spaces in the beginning of the string - bool bQuote = isspace(str[0]) || str[0] == '"'; + bool bQuote = wxIsspace(str[0]) || str[0] == wxT('"'); if ( bQuote ) - strResult += '"'; + strResult += wxT('"'); - char c; + wxChar c; for ( size_t n = 0; n < str.Len(); n++ ) { switch ( str[n] ) { - case '\n': - c = 'n'; + case wxT('\n'): + c = wxT('n'); break; - case '\r': - c = 'r'; + case wxT('\r'): + c = wxT('r'); break; - case '\t': - c = 't'; + case wxT('\t'): + c = wxT('t'); break; - case '\\': - c = '\\'; + case wxT('\\'): + c = wxT('\\'); break; - case '"': + case wxT('"'): if ( bQuote ) { - c = '"'; + c = wxT('"'); break; } //else: fall through @@ -1422,11 +1575,11 @@ static wxString FilterOutValue(const wxString& str) } // we get here only for special characters - strResult << '\\' << c; + strResult << wxT('\\') << c; } if ( bQuote ) - strResult += '"'; + strResult += wxT('"'); return strResult; } @@ -1437,8 +1590,8 @@ static wxString FilterInEntryName(const wxString& str) wxString strResult; strResult.Alloc(str.Len()); - for ( const char *pc = str.c_str(); *pc != '\0'; pc++ ) { - if ( *pc == '\\' ) + for ( const wxChar *pc = str.c_str(); *pc != '\0'; pc++ ) { + if ( *pc == wxT('\\') ) pc++; strResult += *pc; @@ -1453,15 +1606,15 @@ static wxString FilterOutEntryName(const wxString& str) wxString strResult; strResult.Alloc(str.Len()); - for ( const char *pc = str.c_str(); *pc != '\0'; pc++ ) { - char c = *pc; + for ( const wxChar *pc = str.c_str(); *pc != wxT('\0'); pc++ ) { + wxChar c = *pc; // we explicitly allow some of "safe" chars and 8bit ASCII characters // which will probably never have special meaning // NB: note that wxCONFIG_IMMUTABLE_PREFIX and wxCONFIG_PATH_SEPARATOR // should *not* be quoted - if ( !isalnum(c) && !strchr("@_/-!.*%", c) && ((c & 0x80) == 0) ) - strResult += '\\'; + if ( !wxIsalnum(c) && !wxStrchr(wxT("@_/-!.*%"), c) && ((c & 0x80) == 0) ) + strResult += wxT('\\'); strResult += c; } @@ -1469,3 +1622,15 @@ static wxString FilterOutEntryName(const wxString& str) return strResult; } +// we can't put ?: in the ctor initializer list because it confuses some +// broken compilers (Borland C++) +static wxString GetAppName(const wxString& appName) +{ + if ( !appName && wxTheApp ) + return wxTheApp->GetAppName(); + else + return appName; +} + +#endif // wxUSE_CONFIG +