Set the file name for temporary wxFFile objects.

Pass the name of the temporary file to wxFFile::Attach(). This allows to give
more useful error messages if any operation on this file fails later.

Closes #13903.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70492 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-01-31 19:38:45 +00:00
parent 6ea6639cdf
commit d8b130867c

View File

@@ -805,7 +805,7 @@ static bool wxTempOpen(wxFFile *file, const wxString& path, bool *deleteOnClose)
int fd = wxTempOpen(path, deleteOnClose); int fd = wxTempOpen(path, deleteOnClose);
if (fd == -1) if (fd == -1)
return false; return false;
file->Attach(wx_fdopen(fd, "w+b")); file->Attach(wx_fdopen(fd, "w+b"), path);
return file->IsOpened(); return file->IsOpened();
#endif // wx_fdopen #endif // wx_fdopen
} }
@@ -916,7 +916,7 @@ static wxString wxCreateTempImpl(
if ( ffileTemp ) if ( ffileTemp )
{ {
#ifdef wx_fdopen #ifdef wx_fdopen
ffileTemp->Attach(wx_fdopen(fdTemp, "r+b")); ffileTemp->Attach(wx_fdopen(fdTemp, "r+b"), path);
#else #else
ffileTemp->Open(path, wxT("r+b")); ffileTemp->Open(path, wxT("r+b"));
close(fdTemp); close(fdTemp);