#include "wx/utils.h" // for wxGetHomeDir
+#if defined(__WXMAC__)
+ #include "wx/mac/private.h" // includes mac headers
+#endif
+
// _WINDOWS_ is defined when windows.h is included,
// __WXMSW__ is defined for MS Windows compilation
#if defined(__WXMSW__) && !defined(_WINDOWS_)
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;
- }
+ strDir.Printf(wxT("%c:\\OS2\\"), 'A'+drive-1);
}
#elif defined(__WXSTUBS__)
wxASSERT_MSG( FALSE, wxT("TODO") ) ;
+ #elif defined(__DOS__)
+ // There's no such thing as global cfg dir in MS-DOS, let's return
+ // current directory (FIXME_MGL?)
+ return wxT(".\\");
#else // Windows
wxChar szWinDir[MAX_PATH];
::GetWindowsDirectory(szWinDir, MAX_PATH);
{
wxString strDir;
-#if defined(__WXMAC__)
- // no local dir concept on Mac OS 9
+#if defined(__WXMAC__) || defined(__DOS__)
+ // no local dir concept on Mac OS 9 or MS-DOS
return GetGlobalDir() ;
#else
wxGetHomeDir(&strDir);
str << szFile;
- #ifdef __WXMSW__
+ #if defined(__WINDOWS__) || defined(__DOS__)
if ( wxStrchr(szFile, wxT('.')) == NULL )
str << wxT(".ini");
#endif
char buf[1024];
while ( !inStream.Read(buf, WXSIZEOF(buf)).Eof() )
- strTmp += wxString(buf, inStream.LastRead());
+ strTmp.append(wxConvertMB2WX(buf), inStream.LastRead());
- strTmp += wxString(buf, inStream.LastRead());
+ strTmp.append(wxConvertMB2WX(buf), inStream.LastRead());
strTrans = wxTextBuffer::Translate(strTmp);
}
// read/write values
// ----------------------------------------------------------------------------
-bool wxFileConfig::Read(const wxString& key,
- wxString* pStr) const
+bool wxFileConfig::DoReadString(const wxString& key, wxString* pStr) const
{
wxConfigPathChanger path(this, key);
return FALSE;
}
- *pStr = ExpandEnvVars(pEntry->Value());
- return TRUE;
-}
-
-bool wxFileConfig::Read(const wxString& key,
- wxString* pStr, const wxString& defVal) const
-{
- wxConfigPathChanger path(this, key);
-
- wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name());
- bool ok;
- if (pEntry == NULL) {
- if( IsRecordingDefaults() )
- ((wxFileConfig *)this)->Write(key,defVal);
- *pStr = ExpandEnvVars(defVal);
- ok = FALSE;
- }
- else {
- *pStr = ExpandEnvVars(pEntry->Value());
- ok = TRUE;
- }
+ *pStr = pEntry->Value();
- return ok;
+ return TRUE;
}
-bool wxFileConfig::Read(const wxString& key, long *pl) const
+bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const
{
wxString str;
if ( !Read(key, & str) )
return FALSE;
}
- *pl = wxAtol(str);
- return TRUE;
+ return str.ToLong(pl);
}
-bool wxFileConfig::Write(const wxString& key, const wxString& szValue)
+bool wxFileConfig::DoWriteString(const wxString& key, const wxString& szValue)
{
wxConfigPathChanger path(this, key);
return TRUE;
}
-bool wxFileConfig::Write(const wxString& key, long lValue)
+bool wxFileConfig::DoWriteLong(const wxString& key, long lValue)
{
- // ltoa() is not ANSI :-(
- wxString buf;
- buf.Printf(wxT("%ld"), lValue);
- return Write(key, buf);
+ return Write(key, wxString::Format(_T("%ld"), lValue));
}
bool wxFileConfig::Flush(bool /* bCurrentOnly */)