From c50f72182c5cfa68e4238e39aa19fa3afab5b651 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 31 Aug 2004 06:44:16 +0000 Subject: [PATCH] fix "FILEMAN->CreateDirectory leaves temp file hanging around" --- stepmania/src/RageFileManager.cpp | 8 ++++++-- stepmania/src/StepMania.cpp | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/stepmania/src/RageFileManager.cpp b/stepmania/src/RageFileManager.cpp index d07d02f5f1..e7e0beebc5 100644 --- a/stepmania/src/RageFileManager.cpp +++ b/stepmania/src/RageFileManager.cpp @@ -281,7 +281,7 @@ bool RageFileManager::Remove( CString sPath ) continue; bool ret = g_Drivers[i].driver->Remove( p ); - if( !ret ) + if( ret ) Deleted = true; } @@ -295,9 +295,13 @@ void RageFileManager::CreateDir( CString sDir ) f.Open( sTempFile, RageFile::WRITE ); f.Close(); - FILEMAN->Remove( sTempFile ); + // YUCK: The dir cache doesn't have this new file we just created, + // so the delete will fail unless we flush. + FILEMAN->FlushDirCache( sDir ); + FILEMAN->Remove( sTempFile ); } + void RageFileManager::Mount( CString Type, CString Root, CString MountPoint ) { LockMut( *g_Mutex ); diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index a4dd22ccca..45b11ab442 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -1309,8 +1309,8 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam BOOKKEEPER->WriteToDisk(); PROFILEMAN->SaveMachineProfile(); FOREACH_PlayerNumber( p ) - if( PROFILEMAN->IsUsingProfile((PlayerNumber)p) ) - PROFILEMAN->SaveProfile( (PlayerNumber)p ); + if( PROFILEMAN->IsUsingProfile(p) ) + PROFILEMAN->SaveProfile( p ); SCREENMAN->SystemMessage( "Stats saved" ); } else