filemanager/Engine/src/CFileManagerEngine.cpp
branchRCL_3
changeset 13 5181328fad28
parent 9 60626d494346
child 14 efe289f793e7
equal deleted inserted replaced
11:649c558486f0 13:5181328fad28
   857     {
   857     {
   858     // Check name for bad chars
   858     // Check name for bad chars
   859     const TUint16 KMinAllowedChar = 0x0020;
   859     const TUint16 KMinAllowedChar = 0x0020;
   860     const TUint16 KParagraphSeparator = 0x2029;
   860     const TUint16 KParagraphSeparator = 0x2029;
   861     const TUint16 KDot = '.';
   861     const TUint16 KDot = '.';
   862     TInt nameLen( aName.Length() );
   862     TFileName nameAfterTrim( aName );
       
   863     nameAfterTrim.TrimRight(); 
       
   864     TInt nameLen( nameAfterTrim.Length() );
   863     if ( !nameLen )
   865     if ( !nameLen )
   864         {
   866         {
   865         return EFalse;
   867         return EFalse;
   866         }
   868         }
   867     for ( TInt i( 0 ); i < nameLen; i++ )
   869     for ( TInt i( 0 ); i < nameLen; i++ )
   868         {
   870         {
   869         TUint16 ch( aName[ i ] );
   871         TUint16 ch( nameAfterTrim[ i ] );
   870         if ( ch < KMinAllowedChar || ch == KParagraphSeparator )
   872         if ( ch < KMinAllowedChar || ch == KParagraphSeparator )
   871             {
   873             {
   872             return EFalse;
   874             return EFalse;
   873             }
   875             }
   874         }
   876         }
   875     // File system ignores totally dot in the end of name, so 
   877     // File system ignores totally dot in the end of name, so 
   876     // we set here as not valid name, so that user gets correctly informed
   878     // we set here as not valid name, so that user gets correctly informed
   877     if ( aName[ nameLen - 1 ] == KDot || IllegalChars( aName ) )
   879     if ( nameAfterTrim[ nameLen - 1 ] == KDot || IllegalChars( nameAfterTrim ) )
   878         {
   880         {
   879         return EFalse;
   881         return EFalse;
   880         }
   882         }
   881     // Get full path length
   883     // Get full path length
   882     TPtrC pathPtr( aDriveAndPath.Length() ?
   884     TPtrC pathPtr( aDriveAndPath.Length() ?
   905         if ( fullPath )
   907         if ( fullPath )
   906             {
   908             {
   907             TPtr ptr( fullPath->Des() );
   909             TPtr ptr( fullPath->Des() );
   908             ptr.Copy( pathPtr );
   910             ptr.Copy( pathPtr );
   909             CFileManagerUtils::EnsureFinalBackslash( ptr ); // Add backslash before name
   911             CFileManagerUtils::EnsureFinalBackslash( ptr ); // Add backslash before name
   910             ptr.Append( aName );
   912             ptr.Append( nameAfterTrim );
   911             ret = iFs.IsValidName( ptr );
   913             ret = iFs.IsValidName( ptr );
   912             delete fullPath;
   914             delete fullPath;
   913             }
   915             }
   914         }
   916         }
   915     return ret;
   917     return ret;