X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..b9c15d1092eda519ecaae2d48eb28598fca949f1:/src/common/fileconf.cpp?ds=sidebyside diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index a6916f0995..b8fec80df7 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -199,19 +199,7 @@ wxString wxFileConfig::GetGlobalDir() #elif defined(__WXSTUBS__) wxASSERT_MSG( FALSE, wxT("TODO") ) ; #elif defined(__WXMAC__) - { - 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 ) + "/" ; - } - } - } + strDir = wxMacFindFolder( (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder ) ; #else // Windows wxChar szWinDir[MAX_PATH]; ::GetWindowsDirectory(szWinDir, MAX_PATH); @@ -230,13 +218,14 @@ wxString wxFileConfig::GetLocalDir() #ifndef __WXMAC__ wxGetHomeDir(&strDir); -#ifndef __VMS__ -# ifdef __UNIX__ - if (strDir.Last() != wxT('/')) strDir << wxT('/'); +#ifdef __UNIX__ +#ifdef __VMS + if (strDir.Last() != wxT(']')) +#endif + if (strDir.Last() != wxT('/')) strDir << wxT('/'); #else if (strDir.Last() != wxT('\\')) strDir << wxT('\\'); #endif -#endif #else // no local dir concept on mac return GetGlobalDir() ; @@ -267,12 +256,12 @@ wxString wxFileConfig::GetLocalFileName(const wxChar *szFile) #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( ' ' ); + wxString str = wxT( '.' ); #else wxString str = GetLocalDir(); #endif - #ifdef __UNIX__ + #if defined( __UNIX__ ) && !defined( __VMS ) str << wxT('.'); #endif @@ -431,8 +420,15 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal) pEnd = pStart; while ( *++pEnd != wxT(']') ) { - if ( *pEnd == wxT('\n') || *pEnd == wxT('\0') ) + if ( *pEnd == wxT('\\') ) { + // the next char is escaped, so skip it even if it is ']' + pEnd++; + } + + if ( *pEnd == wxT('\n') || *pEnd == wxT('\0') ) { + // we reached the end of line, break out of the loop break; + } } if ( *pEnd != wxT(']') ) { @@ -801,7 +797,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) bool ret = file.Commit(); -#ifdef __WXMAC__ +#if defined(__WXMAC__) && !defined(__UNIX__) if ( ret ) { FSSpec spec ; @@ -815,7 +811,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) FSpSetFInfo( &spec , &finfo ) ; } } -#endif // __WXMAC__ +#endif // __WXMAC__ && !__UNIX__ #ifdef __UNIX__ // restore the old umask if we changed it