Don't leave temporary files created by wxFileName::CreateTempFileName() lying
around.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70686
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/filename.h"
#include "wx/filefn.h"
#include "wx/stdpaths.h"
#include "wx/filename.h"
#include "wx/filefn.h"
#include "wx/stdpaths.h"
+#include "wx/scopeguard.h"
#ifdef __WXMSW__
#include "wx/msw/registry.h"
#ifdef __WXMSW__
#include "wx/msw/registry.h"
{
wxFileName fn(wxFileName::CreateTempFileName("filenametest"));
CPPUNIT_ASSERT( fn.IsOk() );
{
wxFileName fn(wxFileName::CreateTempFileName("filenametest"));
CPPUNIT_ASSERT( fn.IsOk() );
+ wxON_BLOCK_EXIT1( wxRemoveFile, fn.GetFullPath() );
wxDateTime dtAccess, dtMod, dtCreate;
CPPUNIT_ASSERT( fn.GetTimes(&dtAccess, &dtMod, &dtCreate) );
wxDateTime dtAccess, dtMod, dtCreate;
CPPUNIT_ASSERT( fn.GetTimes(&dtAccess, &dtMod, &dtCreate) );
{
wxFileName fn(wxFileName::CreateTempFileName("filenametest"));
CPPUNIT_ASSERT( fn.IsOk() );
{
wxFileName fn(wxFileName::CreateTempFileName("filenametest"));
CPPUNIT_ASSERT( fn.IsOk() );
+ wxON_BLOCK_EXIT1( wxRemoveFile, fn.GetFullPath() );
CPPUNIT_ASSERT( fn.FileExists() );
CPPUNIT_ASSERT( !wxFileName::DirExists(fn.GetFullPath()) );
CPPUNIT_ASSERT( fn.FileExists() );
CPPUNIT_ASSERT( !wxFileName::DirExists(fn.GetFullPath()) );