From df9c4cbd6e3322252fa7adf89ec7019411a82d95 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 19 Apr 2004 22:19:54 +0000 Subject: [PATCH] fix failed writes to "foo.sm" leaving "new.foo.sm" behind, which will trigger an error on the next load --- stepmania/src/RageFileDriverDirect.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stepmania/src/RageFileDriverDirect.cpp b/stepmania/src/RageFileDriverDirect.cpp index f40a624c9a..f82d73ddd5 100644 --- a/stepmania/src/RageFileDriverDirect.cpp +++ b/stepmania/src/RageFileDriverDirect.cpp @@ -66,10 +66,11 @@ RageFileDriverDirect::RageFileDriverDirect( CString root_ ): static CString MakeTempFilename( const CString &sPath ) { - /* "Foo/bar/baz" -> "Foo/bar/new.baz". Prepend to the basename, so if we're - * writing something that might be wildcard-searched, these temp files won't - * match. */ - return Dirname(sPath) + "new." + Basename(sPath); + /* "Foo/bar/baz" -> "Foo/bar/new.baz.new". Both prepend and append: we don't + * want a wildcard search for the filename to match (foo.txt.new matches foo.txt*), + * and we don't want to have the same extension (so "new.foo.sm" doesn't show up + * in *.sm). */ + return Dirname(sPath) + "new." + Basename(sPath) + ".new"; } RageFileObj *MakeFileObjDirect( CString sPath, int mode, RageFile &p, int &err )