From 6ceb13a62a8782295e861c0c5d432883519717cf Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 10 Dec 2003 22:30:40 +0000 Subject: [PATCH] make RageFileDriverDirect::Ready at least plausibly correct in *nix --- stepmania/src/RageFileDriverDirect.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/stepmania/src/RageFileDriverDirect.cpp b/stepmania/src/RageFileDriverDirect.cpp index 7d369a460f..50074d1121 100644 --- a/stepmania/src/RageFileDriverDirect.cpp +++ b/stepmania/src/RageFileDriverDirect.cpp @@ -257,9 +257,9 @@ RageFileObj *RageFileDriverDirect::Open( const CString &path, RageFile::OpenMode { CString sPath = root + path; - /* XXX: make sure this will partially resolve. eg. if "abc/def" exists, - * and we're opening "ABC/DEF/GHI/jkl/mno", make sure this will resolve - * to "abc/def/GHI/jkl/mno"; we'll create the missing ones later. */ + /* This partially resolves. For example, if "abc/def" exists, and we're opening + * "ABC/DEF/GHI/jkl/mno", this will resolve it to "abc/def/GHI/jkl/mno"; we'll + * create the missing parts below. */ FDB->ResolvePath( sPath ); if( mode == RageFile::WRITE ) @@ -319,17 +319,16 @@ bool RageFileDriverDirect::Ready() sizeof(szFileSystemNameBuffer) ); return !!bResult; #else - // Try to create directory before writing a temp file. - CreateDirectories( root ); // XXX + CreateDirectories( root ); // Try to write a file. - CString sFile = root + "temp"; /* XXX no */ - RageFile f; - if( !f.Open( sFile, RageFile::WRITE ) ) + const CString sFile = root + "temp"; + int fd = open( sFile, O_WRONLY|O_CREAT|O_TRUNC ); + if( fd == -1 ) return false; - f.Close(); + close( fd ); remove( sFile ); return true; #endif