Oops, Watcom doesn't have _mktemp in DOS

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-12-15 16:44:43 +00:00
parent 17d5bdf9e9
commit 7070f55b2c

View File

@@ -469,7 +469,7 @@ wxString wxFileName::CreateTempFileName(const wxString& prefix)
::DosCreateDir(wxStringBuffer(path, MAX_PATH), NULL); ::DosCreateDir(wxStringBuffer(path, MAX_PATH), NULL);
#endif #endif
#else // !Windows, !OS/2, !DOS #else // !Windows, !OS/2
if ( dir.empty() ) if ( dir.empty() )
{ {
dir = wxGetenv(_T("TMP")); dir = wxGetenv(_T("TMP"));
@@ -499,19 +499,7 @@ wxString wxFileName::CreateTempFileName(const wxString& prefix)
path += name; path += name;
#if defined(__DOS__) && defined(__WATCOMC__) #if defined(HAVE_MKSTEMP)
// scratch space for mkstemp()
path += _T("XXXXXX");
// can use the cast here because the length doesn't change and the string
// is not shared
if ( !_mktemp((char *)path.mb_str()) )
{
// this might be not necessary as mkstemp() on most systems should have
// already done it but it doesn't hurt neither...
path.clear();
}
#elif defined(HAVE_MKSTEMP)
// scratch space for mkstemp() // scratch space for mkstemp()
path += _T("XXXXXX"); path += _T("XXXXXX");
@@ -534,9 +522,11 @@ wxString wxFileName::CreateTempFileName(const wxString& prefix)
{ {
path.clear(); path.clear();
} }
#else // !HAVE_MKTEMP #else // !HAVE_MKTEMP (includes __DOS__)
// generate the unique file name ourselves // generate the unique file name ourselves
#ifndef __DOS__
path << (unsigned int)getpid(); path << (unsigned int)getpid();
#endif
wxString pathTry; wxString pathTry;