make RageFileDriverDirect::Ready at least plausibly correct in *nix

This commit is contained in:
Glenn Maynard
2003-12-10 22:30:40 +00:00
parent f63a35506a
commit 6ceb13a62a
+8 -9
View File
@@ -257,9 +257,9 @@ RageFileObj *RageFileDriverDirect::Open( const CString &path, RageFile::OpenMode
{ {
CString sPath = root + path; CString sPath = root + path;
/* XXX: make sure this will partially resolve. eg. if "abc/def" exists, /* This partially resolves. For example, if "abc/def" exists, and we're opening
* and we're opening "ABC/DEF/GHI/jkl/mno", make sure this will resolve * "ABC/DEF/GHI/jkl/mno", this will resolve it to "abc/def/GHI/jkl/mno"; we'll
* to "abc/def/GHI/jkl/mno"; we'll create the missing ones later. */ * create the missing parts below. */
FDB->ResolvePath( sPath ); FDB->ResolvePath( sPath );
if( mode == RageFile::WRITE ) if( mode == RageFile::WRITE )
@@ -319,17 +319,16 @@ bool RageFileDriverDirect::Ready()
sizeof(szFileSystemNameBuffer) ); sizeof(szFileSystemNameBuffer) );
return !!bResult; return !!bResult;
#else #else
// Try to create directory before writing a temp file. // Try to create directory before writing a temp file.
CreateDirectories( root ); // XXX CreateDirectories( root );
// Try to write a file. // Try to write a file.
CString sFile = root + "temp"; /* XXX no */ const CString sFile = root + "temp";
RageFile f; int fd = open( sFile, O_WRONLY|O_CREAT|O_TRUNC );
if( !f.Open( sFile, RageFile::WRITE ) ) if( fd == -1 )
return false; return false;
f.Close(); close( fd );
remove( sFile ); remove( sFile );
return true; return true;
#endif #endif