X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b3031762e87338b20e682af9278731aec1d123c6..520e470fdd0daef09c77938db642e4583933c90d:/src/common/fileconf.cpp diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 6a9568e3b5..cb7ca2fa10 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -28,17 +28,19 @@ #endif //__BORLANDC__ #ifndef WX_PRECOMP - #include - #include + #include "wx/string.h" + #include "wx/intl.h" #endif //WX_PRECOMP -#include -#include -#include -#include -#include -#include -#include +#include "wx/app.h" +#include "wx/dynarray.h" +#include "wx/file.h" +#include "wx/log.h" +#include "wx/textfile.h" +#include "wx/config.h" +#include "wx/fileconf.h" + +#include "wx/utils.h" // for wxGetHomeDir // _WINDOWS_ is defined when windows.h is included, // __WXMSW__ is defined for MS Windows compilation @@ -54,6 +56,13 @@ // ---------------------------------------------------------------------------- #define CONST_CAST ((wxFileConfig *)this)-> +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- +#ifndef MAX_PATH + #define MAX_PATH 512 +#endif + // ---------------------------------------------------------------------------- // global functions declarations // ---------------------------------------------------------------------------- @@ -87,15 +96,10 @@ wxString wxFileConfig::GetGlobalDir() #ifdef __UNIX__ strDir = "/etc/"; #elif defined(__WXSTUBS__) - // TODO - wxASSERT( TRUE ) ; + wxASSERT_MSG( FALSE, "TODO" ) ; #else // Windows - #ifndef _MAX_PATH - #define _MAX_PATH 512 - #endif - - char szWinDir[_MAX_PATH]; - ::GetWindowsDirectory(szWinDir, _MAX_PATH); + char szWinDir[MAX_PATH]; + ::GetWindowsDirectory(szWinDir, MAX_PATH); strDir = szWinDir; strDir << '\\'; @@ -107,30 +111,8 @@ wxString wxFileConfig::GetGlobalDir() wxString wxFileConfig::GetLocalDir() { wxString strDir; - - #ifdef __UNIX__ - const char *szHome = getenv("HOME"); - if ( szHome == NULL ) { - // we're homeless... - wxLogWarning(_("can't find user's HOME, using current directory.")); - strDir = "."; - } - else - strDir = szHome; - strDir << '/'; // a double slash is no problem, a missin one yes - #else // Windows - #ifdef __WIN32__ - const char *szHome = getenv("HOMEDRIVE"); - if ( szHome != NULL ) - strDir << szHome; - szHome = getenv("HOMEPATH"); - if ( szHome != NULL ) - strDir << szHome; - #else // Win16 - // Win16 has no idea about home, so use the current directory instead - strDir = ".\\"; - #endif // WIN16/32 - #endif // UNIX/Win + + wxGetHomeDir(&strDir); return strDir; } @@ -877,7 +859,7 @@ wxFileConfig::LineList *wxFileConfig::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 << "[" << (GetFullName().c_str() + 1) << "]"; // +1: no '/' m_pLine = m_pConfig->LineListInsert(strFullName, pParent->GetLastGroupLine()); pParent->SetLastGroup(this); // we're surely after all the others