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() ? |