fix for temp file creation under Windows

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13124 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-12-20 00:40:57 +00:00
parent 44f685055e
commit 90a683695b

View File

@@ -628,7 +628,16 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp)
{
// open the file - of course, there is a race condition here, this is
// why we always prefer using mkstemp()...
if ( !fileTemp->Open(path, wxFile::write_excl, wxS_IRUSR | wxS_IWUSR) )
//
// NB: GetTempFileName() under Windows creates the file, so using
// write_excl there would fail
if ( !fileTemp->Open(path,
#if defined(__WINDOWS__) && !defined(__WXMICROWIN__)
wxFile::write,
#else
wxFile::write_excl,
#endif
wxS_IRUSR | wxS_IWUSR) )
{
// FIXME: If !ok here should we loop and try again with another
// file name? That is the standard recourse if open(O_EXCL)