VError XWinFolder::Rename( const VString& inName, VFolder** outFile ) const { VFilePath newPath( fOwner->GetPath() ); newPath.SetName( inName ); DWORD winErr; if (newPath.IsValid()) { XWinFullPath oldWinPath( fOwner->GetPath() ); XWinFullPath newWinPath( newPath ); winErr = ::MoveFileW( oldWinPath, newWinPath ) ? 0 : ::GetLastError(); } else { winErr = ERROR_INVALID_NAME; } if (outFile) { *outFile = (winErr == 0) ? new VFolder( newPath) : NULL; } return MAKE_NATIVE_VERROR( winErr); }
VError XWinFolder::Move( const VFolder& inNewParent, VFolder** outFolder ) const { XBOX::VString name; VFilePath newPath( inNewParent.GetPath() ); DWORD winErr; if (newPath.IsValid()) { VString name; fOwner->GetName(name); newPath.ToSubFolder(name); XWinFullPath oldWinPath( fOwner->GetPath() ); XWinFullPath newWinPath( newPath ); winErr = ::MoveFileW( oldWinPath, newWinPath) ? 0 : ::GetLastError(); } else { winErr = ERROR_INVALID_NAME; } if (outFolder) { *outFolder = (winErr == 0) ? new VFolder( newPath) : NULL; } return MAKE_NATIVE_VERROR( winErr); }