fix failed writes to "foo.sm" leaving "new.foo.sm" behind, which will

trigger an error on the next load
This commit is contained in:
Glenn Maynard
2004-04-19 22:19:54 +00:00
parent ef44d6eae5
commit df9c4cbd6e
+5 -4
View File
@@ -66,10 +66,11 @@ RageFileDriverDirect::RageFileDriverDirect( CString root_ ):
static CString MakeTempFilename( const CString &sPath ) static CString MakeTempFilename( const CString &sPath )
{ {
/* "Foo/bar/baz" -> "Foo/bar/new.baz". Prepend to the basename, so if we're /* "Foo/bar/baz" -> "Foo/bar/new.baz.new". Both prepend and append: we don't
* writing something that might be wildcard-searched, these temp files won't * want a wildcard search for the filename to match (foo.txt.new matches foo.txt*),
* match. */ * and we don't want to have the same extension (so "new.foo.sm" doesn't show up
return Dirname(sPath) + "new." + Basename(sPath); * in *.sm). */
return Dirname(sPath) + "new." + Basename(sPath) + ".new";
} }
RageFileObj *MakeFileObjDirect( CString sPath, int mode, RageFile &p, int &err ) RageFileObj *MakeFileObjDirect( CString sPath, int mode, RageFile &p, int &err )