mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
add IsLegalName(), Rename()
This commit is contained in:
parent
fc0a71ea85
commit
9b09e73520
2 changed files with 26 additions and 0 deletions
|
@ -61,6 +61,8 @@ class CXWGamesMgr : public CBase
|
|||
|
||||
TBool DeleteSelected( TInt aIndex );
|
||||
TBool Exists( TGameName* aName );
|
||||
TBool IsLegalName( const TGameName* aName );
|
||||
void Rename( const TDesC16* aCurName, const TDesC16* aNewName );
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -119,6 +119,13 @@ CXWGamesMgr::Exists( TGameName* aName )
|
|||
return err == KErrNone;
|
||||
}
|
||||
|
||||
TBool
|
||||
CXWGamesMgr::IsLegalName( const TGameName* aName )
|
||||
{
|
||||
RFs fs = iCoeEnv->FsSession();
|
||||
return fs.IsValidName( *aName );
|
||||
} /* IsLegalName */
|
||||
|
||||
void
|
||||
CXWGamesMgr::GameNameToPath( TFileName* aPath, const TDesC16* aName )
|
||||
{
|
||||
|
@ -219,3 +226,20 @@ CXWGamesMgr::DeleteFileFor( TPtrC16* aName )
|
|||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
void
|
||||
CXWGamesMgr::Rename( const TDesC16* aCurName, const TDesC16* aNewName )
|
||||
{
|
||||
TFileName newName;
|
||||
GameNameToPath( &newName, aNewName );
|
||||
|
||||
TFileName anOldName;
|
||||
GameNameToPath( &anOldName, aCurName );
|
||||
|
||||
RFs fs = iCoeEnv->FsSession();
|
||||
TInt err = fs.Rename( anOldName, newName );
|
||||
XP_ASSERT( err == KErrNone );
|
||||
User::LeaveIfError( err );
|
||||
|
||||
BuildListL();
|
||||
} /* Rename */
|
||||
|
|
Loading…
Reference in a new issue