add optional RageFileDriver::MoveFile override; implement for RageFileDriverDirect and RageFileDriverTimeout

This commit is contained in:
Glenn Maynard
2005-09-28 22:59:12 +00:00
parent 6698a2ba91
commit 04ec4e66f4
7 changed files with 81 additions and 1 deletions
+25
View File
@@ -122,6 +122,31 @@ RageFileBasic *RageFileDriverDirect::Open( const CString &path, int mode, int &e
return MakeFileObjDirect( root + sPath, mode, err );
}
bool RageFileDriverDirect::MoveFile( const CString &sOldPath_, const CString &sNewPath_ )
{
CString sOldPath = sOldPath_;
CString sNewPath = sNewPath_;
FDB->ResolvePath( sOldPath );
FDB->ResolvePath( sNewPath );
if( this->GetFileType(sOldPath) == RageFileManager::TYPE_NONE )
return false;
{
const CString dir = Dirname(sNewPath);
CreateDirectories( root + dir );
}
LOG->Trace("rename \"%s\" -> \"%s\"", (root + sOldPath).c_str(), (root + sNewPath).c_str() );
if( DoRename(root + sOldPath, root + sNewPath) == -1 )
{
LOG->Warn( "rename(%s,%s) failed: %s", (root + sOldPath).c_str(), (root + sNewPath).c_str(), strerror(errno) );
return false;
}
return true;
}
bool RageFileDriverDirect::Remove( const CString &path )
{
CString sPath = path;