172 *aDestOtherDrive = gSessionPath[0] == 'C' ? _L("D:\\F32-TST\\TFMAN\\dest\\") : _L("C:\\F32-TST\\TFMAN\\dest\\"); |
176 *aDestOtherDrive = gSessionPath[0] == 'C' ? _L("D:\\F32-TST\\TFMAN\\dest\\") : _L("C:\\F32-TST\\TFMAN\\dest\\"); |
173 #else |
177 #else |
174 *aDestOtherDrive = gSessionPath[0] == 'C' ? _L("Y:\\F32-TST\\TFMAN\\dest\\") : _L("C:\\F32-TST\\TFMAN\\dest\\"); |
178 *aDestOtherDrive = gSessionPath[0] == 'C' ? _L("Y:\\F32-TST\\TFMAN\\dest\\") : _L("C:\\F32-TST\\TFMAN\\dest\\"); |
175 #endif |
179 #endif |
176 err = TheFs.MkDirAll(*aDestOtherDrive); |
180 err = TheFs.MkDirAll(*aDestOtherDrive); |
177 test(err == KErrNone || err == KErrAlreadyExists); |
181 test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
178 } |
182 } |
179 |
183 |
180 err = TheFs.MkDirAll(sourceName); |
184 err = TheFs.MkDirAll(sourceName); |
181 test(err == KErrNone || err == KErrAlreadyExists); |
185 test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
182 |
186 |
183 err = TheFs.MkDirAll(sourceCompare); |
187 err = TheFs.MkDirAll(sourceCompare); |
184 test(err == KErrNone || err == KErrAlreadyExists); |
188 test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
185 |
189 |
186 err = TheFs.MkDirAll(destSameDrive); |
190 err = TheFs.MkDirAll(destSameDrive); |
187 test(err == KErrNone || err == KErrAlreadyExists); |
191 test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
188 |
192 |
189 if(aCreateFiles) |
193 if(aCreateFiles) |
190 { |
194 { |
191 err = TheFs.MkDirAll(sourceNameSubDir); |
195 err = TheFs.MkDirAll(sourceNameSubDir); |
192 test(err == KErrNone || err == KErrAlreadyExists); |
196 test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
193 |
197 |
194 err = TheFs.MkDirAll(sourceCompareSubDir); |
198 err = TheFs.MkDirAll(sourceCompareSubDir); |
195 test(err == KErrNone || err == KErrAlreadyExists); |
199 test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
196 |
200 |
197 for(TInt i=0; i<5; i++) |
201 for(TInt i=0; i<5; i++) |
198 { |
202 { |
199 // Create a test file to be copied |
203 // Create a test file to be copied |
200 TFileName name = sourceName; |
204 TFileName name = sourceName; |
274 MakeDir(_L("\\TEST\\LONG\\NAME\\ABCDE\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
278 MakeDir(_L("\\TEST\\LONG\\NAME\\ABCDE\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
275 MakeFile(_L("\\TEST\\LONG\\NAME\\ABCDE\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04")); |
279 MakeFile(_L("\\TEST\\LONG\\NAME\\ABCDE\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04")); |
276 MakeFile(_L("\\TEST\\LONG\\NAME\\ABCDE\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04")); |
280 MakeFile(_L("\\TEST\\LONG\\NAME\\ABCDE\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04")); |
277 TFileName name1(KLongName1); |
281 TFileName name1(KLongName1); |
278 r=gFileMan->Rename(_L("\\TEST\\LONG"),name1,CFileMan::EOverWrite); |
282 r=gFileMan->Rename(_L("\\TEST\\LONG"),name1,CFileMan::EOverWrite); |
279 test(r==KErrNone); |
283 test_KErrNone(r); |
280 // Two long directory names - makes paths invalid |
284 // Two long directory names - makes paths invalid |
281 MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ")); |
285 MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ")); |
282 MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
286 MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
283 MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04")); |
287 MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04")); |
284 MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04")); |
288 MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04")); |
285 |
289 |
286 // Testing invalid long file name (i.e. >256) |
290 // Testing invalid long file name (i.e. >256) |
287 r=gFileMan->Rename(_L("\\TEST\\LONG"),KInvalidLongName,CFileMan::EOverWrite); |
291 r=gFileMan->Rename(_L("\\TEST\\LONG"),KInvalidLongName,CFileMan::EOverWrite); |
288 test(r==KErrBadName); |
292 test_Equal(KErrBadName, r); |
289 |
293 |
290 // Testing invalid long path (i.e. >256) |
294 // Testing invalid long path (i.e. >256) |
291 r=gFileMan->Rename(_L("\\TEST\\LONG"),KInvalidLongPath,CFileMan::EOverWrite); |
295 r=gFileMan->Rename(_L("\\TEST\\LONG"),KInvalidLongPath,CFileMan::EOverWrite); |
292 test(r==KErrBadName); |
296 test_Equal(KErrBadName, r); |
293 |
297 |
294 r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite); |
298 r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite); |
295 test(r==KErrNone); |
299 test_KErrNone(r); |
296 } |
300 } |
297 |
301 |
298 //testing invalid source path at the beginning: |
302 //testing invalid source path at the beginning: |
299 if (!gAsynch) |
303 if (!gAsynch) |
300 { |
304 { |
370 Compare(_L("\\F32-TST\\TFMAN\\DELDIR\\*"),_L("\\F32-TST\\TFMAN\\AFTER\\DELDIR\\*")); |
374 Compare(_L("\\F32-TST\\TFMAN\\DELDIR\\*"),_L("\\F32-TST\\TFMAN\\AFTER\\DELDIR\\*")); |
371 |
375 |
372 if (testingInvalidPathLengths) |
376 if (testingInvalidPathLengths) |
373 { |
377 { |
374 r=gFileMan->RmDir(_L("\\TEST\\")); |
378 r=gFileMan->RmDir(_L("\\TEST\\")); |
375 test(r==KErrNone); |
379 test_KErrNone(r); |
376 } |
380 } |
377 |
381 |
378 /** |
382 /** |
379 Test wild card matching in short file names |
383 Test wild card matching in short file names |
380 Note this test is only run on FAT file systems as 'short file names' are only |
384 Note this test is only run on FAT file systems as 'short file names' are only |
381 supported by FAT. |
385 supported by FAT. |
382 DEF130113: TTG:<Wild card characters cannot be handled in the short file names> |
386 DEF130113: TTG:<Wild card characters cannot be handled in the short file names> |
383 */ |
387 */ |
384 TInt theDrive; |
388 TInt theDrive; |
385 r=TheFs.CharToDrive(gDriveToTest,theDrive); |
389 r=TheFs.CharToDrive(gDriveToTest,theDrive); |
386 test(r==KErrNone); |
390 test_KErrNone(r); |
387 TFSName f; |
391 TFSName f; |
388 r = TheFs.FileSystemName(f, theDrive); |
392 r = TheFs.FileSystemName(f, theDrive); |
389 test(r == KErrNone || r == KErrNotFound); |
393 test_Value(r, r == KErrNone || r == KErrNotFound); |
390 if (f.FindF(_L("Fat")) == 0 ) |
394 if (f.FindF(_L("Fat")) == 0 ) |
391 { |
395 { |
392 test.Next(_L("Test wild card matching in short file names")); |
396 test.Next(_L("Test wild card matching in short file names")); |
393 MakeFile(_L("abcdefghi.txt")); |
397 MakeFile(_L("abcdefghi.txt")); |
394 TInt err = gFileMan->Delete(_L("ABCDEF~*")); |
398 TInt err = gFileMan->Delete(_L("ABCDEF~*")); |
395 test(err == KErrNone); |
399 test_KErrNone(err); |
396 MakeFile(_L("abcdefghi.txt")); |
400 MakeFile(_L("abcdefghi.txt")); |
397 err = gFileMan->Delete(_L("ABCDEF~*.TXT")); |
401 err = gFileMan->Delete(_L("ABCDEF~*.TXT")); |
398 test(err == KErrNone); |
402 test_KErrNone(err); |
399 MakeFile(_L("abcdefghi.txt")); |
403 MakeFile(_L("abcdefghi.txt")); |
400 err = gFileMan->Delete(_L("ABCDEF~*.?XT")); |
404 err = gFileMan->Delete(_L("ABCDEF~*.?XT")); |
401 test(err == KErrNone); |
405 test_KErrNone(err); |
402 MakeFile(_L("abcdefghi.txt")); |
406 MakeFile(_L("abcdefghi.txt")); |
403 err = gFileMan->Delete(_L("ABCDEF~1.*")); |
407 err = gFileMan->Delete(_L("ABCDEF~1.*")); |
404 test(err == KErrNone); |
408 test_KErrNone(err); |
405 } |
409 } |
406 } |
410 } |
407 |
411 |
408 LOCAL_C void TestCopy() |
412 LOCAL_C void TestCopy() |
409 // |
413 // |
531 TestResult(r,KErrAlreadyExists); |
535 TestResult(r,KErrAlreadyExists); |
532 |
536 |
533 if (!gAsynch) |
537 if (!gAsynch) |
534 { |
538 { |
535 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
539 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
536 test(r==KErrNone); |
540 test_KErrNone(r); |
537 if (testingInvalidPathLengths) |
541 if (testingInvalidPathLengths) |
538 { |
542 { |
539 test.Next(_L("Test invalid length paths")); |
543 test.Next(_L("Test invalid length paths")); |
540 r=gFileMan->Copy(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\")); |
544 r=gFileMan->Copy(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\")); |
541 test(r==KErrNone); |
545 test_KErrNone(r); |
542 r=gFileMan->RmDir(_L("\\START\\")); |
546 r=gFileMan->RmDir(_L("\\START\\")); |
543 test(r==KErrNone); |
547 test_KErrNone(r); |
544 r=gFileMan->RmDir(_L("\\FINISH\\")); |
548 r=gFileMan->RmDir(_L("\\FINISH\\")); |
545 test(r==KErrNone); |
549 test_KErrNone(r); |
546 } |
550 } |
547 } |
551 } |
548 else |
552 else |
549 { |
553 { |
550 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\COPYDIR\\"),0,gStat); |
554 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\COPYDIR\\"),0,gStat); |
551 WaitForSuccess(); |
555 WaitForSuccess(); |
552 test(r==KErrNone); |
556 test_KErrNone(r); |
553 if (testingInvalidPathLengths) |
557 if (testingInvalidPathLengths) |
554 { |
558 { |
555 test.Next(_L("Test invalid length paths (Asynch)")); |
559 test.Next(_L("Test invalid length paths (Asynch)")); |
556 r=gFileMan->Copy(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"),0,gStat); |
560 r=gFileMan->Copy(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"),0,gStat); |
557 WaitForSuccess(); |
561 WaitForSuccess(); |
558 test(r==KErrNone); |
562 test_KErrNone(r); |
559 r=gFileMan->RmDir(_L("\\START\\"),gStat); |
563 r=gFileMan->RmDir(_L("\\START\\"),gStat); |
560 WaitForSuccess(); |
564 WaitForSuccess(); |
561 test(r==KErrNone); |
565 test_KErrNone(r); |
562 r=gFileMan->RmDir(_L("\\FINISH\\"),gStat); |
566 r=gFileMan->RmDir(_L("\\FINISH\\"),gStat); |
563 WaitForSuccess(); |
567 WaitForSuccess(); |
564 test(r==KErrNone); |
568 test_KErrNone(r); |
565 } |
569 } |
566 } |
570 } |
567 |
571 |
568 if (!gAsynch) |
572 if (!gAsynch) |
569 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\NewDir\\*.*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
573 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\NewDir\\*.*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
1015 MakeFile(_L("\\START\\LONG\\ABCDEFGH01ABCDEFGH01ABCDEFGH01ABCDEFGH01.txt")); |
1023 MakeFile(_L("\\START\\LONG\\ABCDEFGH01ABCDEFGH01ABCDEFGH01ABCDEFGH01.txt")); |
1016 MakeFile(_L("\\START\\LONG\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt")); |
1024 MakeFile(_L("\\START\\LONG\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt")); |
1017 MakeFile(_L("\\START\\LONG\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt")); |
1025 MakeFile(_L("\\START\\LONG\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt")); |
1018 MakeFile(_L("\\START\\LONG\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.txt")); |
1026 MakeFile(_L("\\START\\LONG\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.txt")); |
1019 r=gFileMan->Rename(_L("\\START\\LONG"),_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite); |
1027 r=gFileMan->Rename(_L("\\START\\LONG"),_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite); |
1020 test(r==KErrNone); |
1028 test_KErrNone(r); |
1021 |
1029 |
1022 // Two long directory names - makes paths invalid |
1030 // Two long directory names - makes paths invalid |
1023 MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ")); |
1031 MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ")); |
1024 MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
1032 MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
1025 MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04")); |
1033 MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04")); |
1026 MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04")); |
1034 MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04")); |
1027 r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite); |
1035 r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite); |
1028 test(r==KErrNone); |
1036 test_KErrNone(r); |
1029 |
1037 |
1030 MakeDir(_L("\\START\\ASDFFDSA\\")); |
1038 MakeDir(_L("\\START\\ASDFFDSA\\")); |
1031 } |
1039 } |
1032 |
1040 |
1033 //testing invalid source path at the beginning: |
1041 //testing invalid source path at the beginning: |
1104 TestResult(r,KErrNone); |
1112 TestResult(r,KErrNone); |
1105 |
1113 |
1106 if ((!gAsynch)&&(testingInvalidPathLengths)) |
1114 if ((!gAsynch)&&(testingInvalidPathLengths)) |
1107 { |
1115 { |
1108 r=gFileMan->Move(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\")); |
1116 r=gFileMan->Move(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\")); |
1109 test(r==KErrNone); |
1117 test_KErrNone(r); |
1110 |
1118 |
1111 r=gFileMan->Move(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\*.*"),_L("\\FINISH\\"), CFileMan::EOverWrite | CFileMan::ERecurse); |
1119 r=gFileMan->Move(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\*.*"),_L("\\FINISH\\"), CFileMan::EOverWrite | CFileMan::ERecurse); |
1112 test(r==KErrNone); |
1120 test_KErrNone(r); |
1113 |
1121 |
1114 r=gFileMan->RmDir(_L("\\START\\")); |
1122 r=gFileMan->RmDir(_L("\\START\\")); |
1115 test(r==KErrNone); |
1123 test_KErrNone(r); |
1116 r=gFileMan->RmDir(_L("\\FINISH\\")); |
1124 r=gFileMan->RmDir(_L("\\FINISH\\")); |
1117 test(r==KErrNone); |
1125 test_KErrNone(r); |
1118 } |
1126 } |
1119 if ((gAsynch)&&(testingInvalidPathLengths)) |
1127 if ((gAsynch)&&(testingInvalidPathLengths)) |
1120 { |
1128 { |
1121 r=gFileMan->Move(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"),CFileMan::EOverWrite,gStat); |
1129 r=gFileMan->Move(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"),CFileMan::EOverWrite,gStat); |
1122 User::WaitForRequest(gStat); |
1130 User::WaitForRequest(gStat); |
1123 test(r==KErrNone); |
1131 test_KErrNone(r); |
1124 r=gFileMan->Move(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\*.*"),_L("\\FINISH\\"), CFileMan::EOverWrite | CFileMan::ERecurse,gStat); |
1132 r=gFileMan->Move(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\*.*"),_L("\\FINISH\\"), CFileMan::EOverWrite | CFileMan::ERecurse,gStat); |
1125 User::WaitForRequest(gStat); |
1133 User::WaitForRequest(gStat); |
1126 test(r==KErrNone); |
1134 test_KErrNone(r); |
1127 r=gFileMan->RmDir(_L("\\START\\"),gStat); |
1135 r=gFileMan->RmDir(_L("\\START\\"),gStat); |
1128 WaitForSuccess(); |
1136 WaitForSuccess(); |
1129 test(r==KErrNone); |
1137 test_KErrNone(r); |
1130 r=gFileMan->RmDir(_L("\\FINISH\\"),gStat); |
1138 r=gFileMan->RmDir(_L("\\FINISH\\"),gStat); |
1131 WaitForSuccess(); |
1139 WaitForSuccess(); |
1132 test(r==KErrNone); |
1140 test_KErrNone(r); |
1133 } |
1141 } |
1134 |
1142 |
1135 if (!gAsynch) |
1143 if (!gAsynch) |
1136 r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
1144 r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
1137 else |
1145 else |
1314 _LIT(KTestFile, "\\TESTFILE.TXT"); |
1322 _LIT(KTestFile, "\\TESTFILE.TXT"); |
1315 |
1323 |
1316 test.Printf(_L("1: Create Test File\n")); |
1324 test.Printf(_L("1: Create Test File\n")); |
1317 RFile testFile; |
1325 RFile testFile; |
1318 r = testFile.Create(TheFs, KTestFile, EFileRead | EFileWrite); |
1326 r = testFile.Create(TheFs, KTestFile, EFileRead | EFileWrite); |
1319 test(r == KErrNone); |
1327 test_KErrNone(r); |
1320 |
1328 |
1321 test.Printf(_L("2: Populate testFile1 Data\n")); |
1329 test.Printf(_L("2: Populate testFile1 Data\n")); |
1322 r = testFile.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); |
1330 r = testFile.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); |
1323 test(r == KErrNone); |
1331 test_KErrNone(r); |
1324 |
1332 |
1325 test.Printf(_L("3: Get Initial Attributes\n")); |
1333 test.Printf(_L("3: Get Initial Attributes\n")); |
1326 TUint atts = 0; |
1334 TUint atts = 0; |
1327 r = testFile.Att(atts); |
1335 r = testFile.Att(atts); |
1328 test(r == KErrNone); |
1336 test_KErrNone(r); |
1329 test.Printf(_L(" Attributes: %08x"), atts); |
1337 test.Printf(_L(" Attributes: %08x"), atts); |
1330 |
1338 |
1331 test.Printf(_L("4: Set KEntryAttHidden Attribute\n")); |
1339 test.Printf(_L("4: Set KEntryAttHidden Attribute\n")); |
1332 r = testFile.SetAtt(KEntryAttHidden, 0); |
1340 r = testFile.SetAtt(KEntryAttHidden, 0); |
1333 test(r == KErrNone); |
1341 test_KErrNone(r); |
1334 |
1342 |
1335 test.Printf(_L("5: Verify KEntryAttHidden Attribute is set for testFile1\n")); |
1343 test.Printf(_L("5: Verify KEntryAttHidden Attribute is set for testFile1\n")); |
1336 r = testFile.Att(atts); |
1344 r = testFile.Att(atts); |
1337 test(r == KErrNone); |
1345 test_KErrNone(r); |
1338 test(atts & KEntryAttHidden); |
1346 test(atts & KEntryAttHidden); |
1339 |
1347 |
1340 test.Printf(_L("6: Read Data from beginning of file testFile1\n")); |
1348 test.Printf(_L("6: Read Data from beginning of file testFile1\n")); |
1341 TBuf8<4> data; |
1349 TBuf8<4> data; |
1342 r = testFile.Read(0, data); |
1350 r = testFile.Read(0, data); |
1343 test(r == KErrNone); |
1351 test_KErrNone(r); |
1344 |
1352 |
1345 test.Printf(_L("7: Close all the testFiles\n")); |
1353 test.Printf(_L("7: Close all the testFiles\n")); |
1346 testFile.Close(); |
1354 testFile.Close(); |
1347 |
1355 |
1348 test.Printf(_L("8: Verify KEntryAttHidden is present\n")); |
1356 test.Printf(_L("8: Verify KEntryAttHidden is present\n")); |
1349 r = TheFs.Att(KTestFile, atts); |
1357 r = TheFs.Att(KTestFile, atts); |
1350 test(r == KErrNone); |
1358 test_KErrNone(r); |
1351 test.Printf(_L(" Finally, attributes are : %08x\n"), atts); |
1359 test.Printf(_L(" Finally, attributes are : %08x\n"), atts); |
1352 test(atts & KEntryAttHidden); |
1360 test(atts & KEntryAttHidden); |
1353 |
1361 |
1354 test.Printf(_L("9: Delete Test File\n")); |
1362 test.Printf(_L("9: Delete Test File\n")); |
1355 r = TheFs.Delete(KTestFile); |
1363 r = TheFs.Delete(KTestFile); |
1356 test(r == KErrNone || r == KErrNotFound); |
1364 test_Value(r, r == KErrNone || r == KErrNotFound); |
1357 } |
1365 } |
1358 |
1366 |
1359 LOCAL_C void TestDEF113299() |
1367 LOCAL_C void TestDEF113299() |
1360 { |
1368 { |
1361 test.Next(_L("Test invalid file rename (DEF113299)")); |
1369 test.Next(_L("Test invalid file rename (DEF113299)")); |
1492 TestResult(r,KErrBadName,KErrNone); |
1500 TestResult(r,KErrBadName,KErrNone); |
1493 |
1501 |
1494 if (!gAsynch) |
1502 if (!gAsynch) |
1495 { |
1503 { |
1496 r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite); |
1504 r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite); |
1497 test(r==KErrNone); |
1505 test_KErrNone(r); |
1498 if (testingInvalidPathLengths) |
1506 if (testingInvalidPathLengths) |
1499 { |
1507 { |
1500 r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.txt"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.bin")); |
1508 r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.txt"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.bin")); |
1501 test(r==KErrBadName); |
1509 test_Equal(KErrBadName, r); |
1502 r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),_L("\\Shortened"),CFileMan::EOverWrite); |
1510 r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),_L("\\Shortened"),CFileMan::EOverWrite); |
1503 test(r==KErrNone); |
1511 test_KErrNone(r); |
1504 r=gFileMan->Rename(_L("\\Shortened\\*.txt"),_L("\\Shortened\\*.cat")); |
1512 r=gFileMan->Rename(_L("\\Shortened\\*.txt"),_L("\\Shortened\\*.cat")); |
1505 test(r==KErrNone); |
1513 test_KErrNone(r); |
1506 r=gFileMan->RmDir(_L("\\Shortened\\")); |
1514 r=gFileMan->RmDir(_L("\\Shortened\\")); |
1507 test(r==KErrNone); |
1515 test_KErrNone(r); |
1508 |
1516 |
1509 r=gFileMan->Rename(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\NotSoShortened"),CFileMan::EOverWrite); |
1517 r=gFileMan->Rename(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\NotSoShortened"),CFileMan::EOverWrite); |
1510 test(r==KErrNone); |
1518 test_KErrNone(r); |
1511 r=gFileMan->Rename(_L("\\TEST"),_L("\\OXO!")); |
1519 r=gFileMan->Rename(_L("\\TEST"),_L("\\OXO!")); |
1512 test(r==KErrNone); |
1520 test_KErrNone(r); |
1513 r=gFileMan->Rename(_L("\\OXO!\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as"),_L("\\OXO!\\Shorter")); |
1521 r=gFileMan->Rename(_L("\\OXO!\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as"),_L("\\OXO!\\Shorter")); |
1514 test(r==KErrNone); |
1522 test_KErrNone(r); |
1515 r=gFileMan->Rename(_L("\\OXO!\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.txt"),_L("\\TEST\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.cat")); |
1523 r=gFileMan->Rename(_L("\\OXO!\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.txt"),_L("\\TEST\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.cat")); |
1516 test(r==KErrNone); |
1524 test_KErrNone(r); |
1517 r=gFileMan->RmDir(_L("\\OXO!\\")); |
1525 r=gFileMan->RmDir(_L("\\OXO!\\")); |
1518 test(r==KErrNone); |
1526 test_KErrNone(r); |
1519 |
1527 |
1520 } |
1528 } |
1521 } |
1529 } |
1522 else |
1530 else |
1523 { |
1531 { |
1524 r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat); |
1532 r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat); |
1525 WaitForSuccess(); |
1533 WaitForSuccess(); |
1526 if (testingInvalidPathLengths) |
1534 if (testingInvalidPathLengths) |
1527 { |
1535 { |
1528 r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.txt"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.bin")); |
1536 r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.txt"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.bin")); |
1529 test(r==KErrBadName); |
1537 test_Equal(KErrBadName, r); |
1530 r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),_L("\\Shortened"),CFileMan::EOverWrite,gStat); |
1538 r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),_L("\\Shortened"),CFileMan::EOverWrite,gStat); |
1531 WaitForSuccess(); |
1539 WaitForSuccess(); |
1532 r=gFileMan->Rename(_L("\\Shortened\\*.txt"),_L("\\Shortened\\*.bin"),0,gStat); |
1540 r=gFileMan->Rename(_L("\\Shortened\\*.txt"),_L("\\Shortened\\*.bin"),0,gStat); |
1533 WaitForSuccess(); |
1541 WaitForSuccess(); |
1534 r=gFileMan->RmDir(_L("\\Shortened\\"),gStat); |
1542 r=gFileMan->RmDir(_L("\\Shortened\\"),gStat); |
1535 WaitForSuccess(); |
1543 WaitForSuccess(); |
1536 |
1544 |
1537 r=gFileMan->Rename(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\NotSoShortened"),CFileMan::EOverWrite,gStat); |
1545 r=gFileMan->Rename(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\NotSoShortened"),CFileMan::EOverWrite,gStat); |
1538 WaitForSuccess(); |
1546 WaitForSuccess(); |
1539 test(r==KErrNone); |
1547 test_KErrNone(r); |
1540 r=gFileMan->Rename(_L("\\TEST"),_L("\\OXO!"),CFileMan::EOverWrite,gStat); |
1548 r=gFileMan->Rename(_L("\\TEST"),_L("\\OXO!"),CFileMan::EOverWrite,gStat); |
1541 WaitForSuccess(); |
1549 WaitForSuccess(); |
1542 test(r==KErrNone); |
1550 test_KErrNone(r); |
1543 r=gFileMan->Rename(_L("\\OXO!\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as"),_L("\\OXO!\\Shorter"),CFileMan::EOverWrite,gStat); |
1551 r=gFileMan->Rename(_L("\\OXO!\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as"),_L("\\OXO!\\Shorter"),CFileMan::EOverWrite,gStat); |
1544 WaitForSuccess(); |
1552 WaitForSuccess(); |
1545 test(r==KErrNone); |
1553 test_KErrNone(r); |
1546 r=gFileMan->Rename(_L("\\OXO!\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.txt"),_L("\\TEST\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.cat"),CFileMan::EOverWrite,gStat); |
1554 r=gFileMan->Rename(_L("\\OXO!\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.txt"),_L("\\TEST\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.cat"),CFileMan::EOverWrite,gStat); |
1547 WaitForSuccess(); |
1555 WaitForSuccess(); |
1548 test(r==KErrNone); |
1556 test_KErrNone(r); |
1549 r=gFileMan->RmDir(_L("\\OXO!\\")); |
1557 r=gFileMan->RmDir(_L("\\OXO!\\")); |
1550 test(r==KErrNone); |
1558 test_KErrNone(r); |
1551 r=gFileMan->RmDir(_L("\\TEST\\")); |
1559 r=gFileMan->RmDir(_L("\\TEST\\")); |
1552 test(r==KErrNone); |
1560 test_KErrNone(r); |
1553 } |
1561 } |
1554 } |
1562 } |
1555 RmDir(_L("\\F32-TST\\TFMAN\\after\\")); |
1563 RmDir(_L("\\F32-TST\\TFMAN\\after\\")); |
1556 MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\abcDEF.DDB")); |
1564 MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\abcDEF.DDB")); |
1557 MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\abxx.DDB")); |
1565 MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\abxx.DDB")); |
1596 |
1604 |
1597 // Test behaviour for omitted parameters |
1605 // Test behaviour for omitted parameters |
1598 // For this, default should be session path |
1606 // For this, default should be session path |
1599 TFileName sessionPath; |
1607 TFileName sessionPath; |
1600 TInt err=TheFs.SessionPath(sessionPath); |
1608 TInt err=TheFs.SessionPath(sessionPath); |
1601 test(err==KErrNone); |
1609 test_KErrNone(err); |
1602 |
1610 |
1603 SetupDirectories(ETrue, NULL); |
1611 SetupDirectories(ETrue, NULL); |
1604 err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\dest\\")); |
1612 err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\dest\\")); |
1605 test(err == KErrNone); |
1613 test_KErrNone(err); |
1606 |
1614 |
1607 err = gFileMan->Rename(_L("\\F32-TST\\TFMAN\\source"), _L("")); |
1615 err = gFileMan->Rename(_L("\\F32-TST\\TFMAN\\source"), _L("")); |
1608 test(err == KErrNone); |
1616 test_KErrNone(err); |
1609 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*")); |
1617 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*")); |
1610 |
1618 |
1611 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
1619 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
1612 RmDir(_L("\\F32-TST\\TFMAN\\source\\")); |
1620 RmDir(_L("\\F32-TST\\TFMAN\\source\\")); |
1613 SetupDirectories(ETrue, NULL); |
1621 SetupDirectories(ETrue, NULL); |
1614 err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\")); |
1622 err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\")); |
1615 test(err == KErrNone); |
1623 test_KErrNone(err); |
1616 |
1624 |
1617 err = gFileMan->Rename(_L(""), _L("\\F32-TST\\TFMAN\\dest\\")); |
1625 err = gFileMan->Rename(_L(""), _L("\\F32-TST\\TFMAN\\dest\\")); |
1618 test(err == KErrNone); |
1626 test_KErrNone(err); |
1619 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
1627 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
1620 |
1628 |
1621 err=TheFs.SetSessionPath(sessionPath); |
1629 err=TheFs.SetSessionPath(sessionPath); |
1622 test(err==KErrNone); |
1630 test_KErrNone(err); |
1623 |
1631 |
1624 TestINC109754(); // Test empty source directory should exist after contents being renamed |
1632 TestINC109754(); // Test empty source directory should exist after contents being renamed |
1625 TestDEF092084(); // Test wildcards are replaced with letters from the matched file |
1633 TestDEF092084(); // Test wildcards are replaced with letters from the matched file |
1626 TestDEF113299(); // Test invalid file rename |
1634 TestDEF113299(); // Test invalid file rename |
1627 } |
1635 } |
1639 TUint setMask=KEntryAttReadOnly; |
1647 TUint setMask=KEntryAttReadOnly; |
1640 TUint clearMask=KEntryAttHidden|KEntryAttArchive; |
1648 TUint clearMask=KEntryAttHidden|KEntryAttArchive; |
1641 if (!gAsynch) |
1649 if (!gAsynch) |
1642 { |
1650 { |
1643 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),setMask,clearMask,TTime(0)); |
1651 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),setMask,clearMask,TTime(0)); |
1644 test(r==KErrNone); |
1652 test_KErrNone(r); |
1645 } |
1653 } |
1646 else |
1654 else |
1647 { |
1655 { |
1648 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),setMask,clearMask,TTime(0),0,gStat); |
1656 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),setMask,clearMask,TTime(0),0,gStat); |
1649 test(r==KErrNone); |
1657 test_KErrNone(r); |
1650 WaitForSuccess(); |
1658 WaitForSuccess(); |
1651 } |
1659 } |
1652 |
1660 |
1653 CDirScan* scan=CDirScan::NewL(TheFs); |
1661 CDirScan* scan=CDirScan::NewL(TheFs); |
1654 scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\ATTRIBS\\*"),KEntryAttMaskSupported,ESortByName); |
1662 scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\ATTRIBS\\*"),KEntryAttMaskSupported,ESortByName); |
1655 CDir* entryList; |
1663 CDir* entryList; |
1656 scan->NextL(entryList); |
1664 scan->NextL(entryList); |
1657 TInt count=entryList->Count(); |
1665 TInt count=entryList->Count(); |
1658 test(count==2); |
1666 test_Equal(2, count); |
1659 TEntry entry=(*entryList)[0]; |
1667 TEntry entry=(*entryList)[0]; |
1660 test(entry.iName.MatchF(_L("attrib1.AT"))!=KErrNotFound); |
1668 test(entry.iName.MatchF(_L("attrib1.AT"))!=KErrNotFound); |
1661 test(entry.iAtt==KEntryAttReadOnly); |
1669 test_Equal(KEntryAttReadOnly, entry.iAtt); |
1662 entry=(*entryList)[1]; |
1670 entry=(*entryList)[1]; |
1663 test(entry.iName.MatchF(_L("attrib2.AT"))!=KErrNotFound); |
1671 test(entry.iName.MatchF(_L("attrib2.AT"))!=KErrNotFound); |
1664 test(entry.iAtt==KEntryAttReadOnly); |
1672 test_Equal(KEntryAttReadOnly, entry.iAtt); |
1665 delete entryList; |
1673 delete entryList; |
1666 |
1674 |
1667 TDateTime dateTime(1990,ENovember,20,9,5,0,0); |
1675 TDateTime dateTime(1990,ENovember,20,9,5,0,0); |
1668 TTime time(dateTime); // FAT loses microseconds if try to convert HomeTime() |
1676 TTime time(dateTime); // FAT loses microseconds if try to convert HomeTime() |
1669 |
1677 |
1670 if (!gAsynch) |
1678 if (!gAsynch) |
1671 { |
1679 { |
1672 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),0,legalAttMask,time); |
1680 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),0,legalAttMask,time); |
1673 test(r==KErrNone); |
1681 test_KErrNone(r); |
1674 } |
1682 } |
1675 else |
1683 else |
1676 { |
1684 { |
1677 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),0,legalAttMask,time,0,gStat); |
1685 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),0,legalAttMask,time,0,gStat); |
1678 test(r==KErrNone); |
1686 test_KErrNone(r); |
1679 WaitForSuccess(); |
1687 WaitForSuccess(); |
1680 } |
1688 } |
1681 |
1689 |
1682 scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\ATTRIBS\\*"),KEntryAttMaskSupported,ESortByName); |
1690 scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\ATTRIBS\\*"),KEntryAttMaskSupported,ESortByName); |
1683 scan->NextL(entryList); |
1691 scan->NextL(entryList); |
1684 count=entryList->Count(); |
1692 count=entryList->Count(); |
1685 test(count==2); |
1693 test_Equal(2, count); |
1686 entry=(*entryList)[0]; |
1694 entry=(*entryList)[0]; |
1687 test(entry.iName.MatchF(_L("attrib1.AT"))!=KErrNotFound); |
1695 test(entry.iName.MatchF(_L("attrib1.AT"))!=KErrNotFound); |
1688 test(entry.iAtt==0); |
1696 test_Equal(0, entry.iAtt); |
1689 TDateTime dt=(entry.iModified).DateTime(); |
1697 TDateTime dt=(entry.iModified).DateTime(); |
1690 test(dt.Year()==dateTime.Year()); |
1698 test(dt.Year()==dateTime.Year()); |
1691 test(dt.Month()==dateTime.Month()); |
1699 test(dt.Month()==dateTime.Month()); |
1692 test(dt.Day()==dateTime.Day()); |
1700 test(dt.Day()==dateTime.Day()); |
1693 test(dt.Hour()==dateTime.Hour()); |
1701 test(dt.Hour()==dateTime.Hour()); |
1694 test(dt.Minute()==dateTime.Minute()); |
1702 test(dt.Minute()==dateTime.Minute()); |
1695 test(dt.Second()==dateTime.Second()); |
1703 test(dt.Second()==dateTime.Second()); |
1696 test(entry.iModified==time); |
1704 test(entry.iModified==time); |
1697 entry=(*entryList)[1]; |
1705 entry=(*entryList)[1]; |
1698 test(entry.iName.MatchF(_L("attrib2.AT"))!=KErrNotFound); |
1706 test(entry.iName.MatchF(_L("attrib2.AT"))!=KErrNotFound); |
1699 test(entry.iAtt==0); |
1707 test_Equal(0, entry.iAtt); |
1700 test(entry.iModified==time); |
1708 test(entry.iModified==time); |
1701 delete entryList; |
1709 delete entryList; |
1702 delete scan; |
1710 delete scan; |
1703 |
1711 |
1704 TestINC111038(); // Test example of incorrect attribute flushing |
1712 TestINC111038(); // Test example of incorrect attribute flushing |
1811 TestResult(r,KErrNone,KErrNone); |
1819 TestResult(r,KErrNone,KErrNone); |
1812 |
1820 |
1813 if (!gAsynch) |
1821 if (!gAsynch) |
1814 { |
1822 { |
1815 r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\RMDIR\\*.AT")); |
1823 r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\RMDIR\\*.AT")); |
1816 test(r==KErrNone); |
1824 test_KErrNone(r); |
1817 if (testingInvalidPathLengths) |
1825 if (testingInvalidPathLengths) |
1818 { |
1826 { |
1819 r=gFileMan->RmDir(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\")); |
1827 r=gFileMan->RmDir(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\")); |
1820 test(r==KErrNone); |
1828 test_KErrNone(r); |
1821 } |
1829 } |
1822 } |
1830 } |
1823 else |
1831 else |
1824 { |
1832 { |
1825 r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\RMDIR\\*.AT"),gStat); |
1833 r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\RMDIR\\*.AT"),gStat); |
1826 test(r==KErrNone); |
1834 test_KErrNone(r); |
1827 WaitForSuccess(); |
1835 WaitForSuccess(); |
1828 if (testingInvalidPathLengths) |
1836 if (testingInvalidPathLengths) |
1829 { |
1837 { |
1830 r=gFileMan->RmDir(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\"),gStat); |
1838 r=gFileMan->RmDir(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\"),gStat); |
1831 test(r==KErrNone); |
1839 test_KErrNone(r); |
1832 WaitForSuccess(); |
1840 WaitForSuccess(); |
1833 } |
1841 } |
1834 } |
1842 } |
1835 |
1843 |
1836 TEntry entry; |
1844 TEntry entry; |
1837 r=TheFs.Entry(_L("\\F32-TST\\TFMAN\\RMDIR"),entry); |
1845 r=TheFs.Entry(_L("\\F32-TST\\TFMAN\\RMDIR"),entry); |
1838 test(r==KErrNotFound); |
1846 test_Equal(KErrNotFound, r); |
1839 |
1847 |
1840 MakeDir(_L("\\F32-TST\\TFMAN\\READONLY\\")); |
1848 MakeDir(_L("\\F32-TST\\TFMAN\\READONLY\\")); |
1841 r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\READONLY\\"),KEntryAttReadOnly,0); |
1849 r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\READONLY\\"),KEntryAttReadOnly,0); |
1842 test(r==KErrNone); |
1850 test_KErrNone(r); |
1843 |
1851 |
1844 if (!gAsynch) |
1852 if (!gAsynch) |
1845 { |
1853 { |
1846 r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\")); |
1854 r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\")); |
1847 test(r==KErrAccessDenied); |
1855 test_Equal(KErrAccessDenied, r); |
1848 } |
1856 } |
1849 else |
1857 else |
1850 { |
1858 { |
1851 r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\"),gStat); |
1859 r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\"),gStat); |
1852 test(r==KErrNone); |
1860 test_KErrNone(r); |
1853 WaitForResult(KErrAccessDenied); |
1861 WaitForResult(KErrAccessDenied); |
1854 } |
1862 } |
1855 |
1863 |
1856 r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\READONLY\\"),0,KEntryAttReadOnly); |
1864 r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\READONLY\\"),0,KEntryAttReadOnly); |
1857 test(r==KErrNone); |
1865 test_KErrNone(r); |
1858 |
1866 |
1859 r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\")); |
1867 r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\")); |
1860 test(r==KErrNone); |
1868 test_KErrNone(r); |
1861 |
1869 |
1862 // Test behaviour for omitted parameters |
1870 // Test behaviour for omitted parameters |
1863 // For this, default should be session path |
1871 // For this, default should be session path |
1864 TFileName sessionPath; |
1872 TFileName sessionPath; |
1865 r=TheFs.SessionPath(sessionPath); |
1873 r=TheFs.SessionPath(sessionPath); |
1866 test(r==KErrNone); |
1874 test_KErrNone(r); |
1867 |
1875 |
1868 SetupDirectories(ETrue, NULL); |
1876 SetupDirectories(ETrue, NULL); |
1869 r=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\")); |
1877 r=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\")); |
1870 |
1878 |
1871 // Default removal of session path |
1879 // Default removal of session path |
1872 r=gFileMan->RmDir(_L("")); |
1880 r=gFileMan->RmDir(_L("")); |
1873 test(r==KErrNone); |
1881 test_KErrNone(r); |
1874 |
1882 |
1875 r=TheFs.SetSessionPath(sessionPath); |
1883 r=TheFs.SetSessionPath(sessionPath); |
1876 |
1884 |
1877 r = gFileMan->Rename(_L("\\F32-TST\\TFMAN\\source\\subdir"), _L("\\F32-TST\\TFMAN\\source\\tofail"), CFileMan::ERecurse); |
1885 r = gFileMan->Rename(_L("\\F32-TST\\TFMAN\\source\\subdir"), _L("\\F32-TST\\TFMAN\\source\\tofail"), CFileMan::ERecurse); |
1878 test(r == KErrPathNotFound); |
1886 test_Equal(KErrPathNotFound, r); |
1879 |
1887 |
1880 r = gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\")); |
1888 r = gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\")); |
1881 test(r==KErrNone); |
1889 test_KErrNone(r); |
1882 MakeDir(_L("\\F32-TST\\TFMAN\\")); |
1890 MakeDir(_L("\\F32-TST\\TFMAN\\")); |
1883 |
1891 |
1884 if(testingInvalidPathLengths) |
1892 if(testingInvalidPathLengths) |
1885 { |
1893 { |
1886 TestINC091841(); // Test delete long fullnames |
1894 TestINC091841(); // Test delete long fullnames |
2019 MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\SUBDIR\\ATFILE.TXT")); |
2027 MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\SUBDIR\\ATFILE.TXT")); |
2020 |
2028 |
2021 if (!gAsynch) |
2029 if (!gAsynch) |
2022 { |
2030 { |
2023 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),KEntryAttReadOnly,0,TTime(0),CFileMan::ERecurse); |
2031 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),KEntryAttReadOnly,0,TTime(0),CFileMan::ERecurse); |
2024 test(r==KErrNone); |
2032 test_KErrNone(r); |
2025 } |
2033 } |
2026 else |
2034 else |
2027 { |
2035 { |
2028 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),KEntryAttReadOnly,0,TTime(0),CFileMan::ERecurse,gStat); |
2036 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),KEntryAttReadOnly,0,TTime(0),CFileMan::ERecurse,gStat); |
2029 test(r==KErrNone); |
2037 test_KErrNone(r); |
2030 WaitForSuccess(); |
2038 WaitForSuccess(); |
2031 } |
2039 } |
2032 |
2040 |
2033 CDir* entryList; |
2041 CDir* entryList; |
2034 CDirScan* scan=CDirScan::NewL(TheFs); |
2042 CDirScan* scan=CDirScan::NewL(TheFs); |
2035 scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\*"),KEntryAttMaskSupported,ESortByName); |
2043 scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\*"),KEntryAttMaskSupported,ESortByName); |
2036 scan->NextL(entryList); |
2044 scan->NextL(entryList); |
2037 TInt count=entryList->Count(); |
2045 TInt count=entryList->Count(); |
2038 test(count==3); |
2046 test_Equal(3, count); |
2039 TEntry entry=(*entryList)[0]; |
2047 TEntry entry=(*entryList)[0]; |
2040 test(entry.iName.MatchF(_L("ATTRIB1.AT"))!=KErrNotFound); |
2048 test(entry.iName.MatchF(_L("ATTRIB1.AT"))!=KErrNotFound); |
2041 if (!IsTestingLFFS()) |
2049 if (!IsTestingLFFS()) |
2042 test(entry.iAtt==(KEntryAttReadOnly|KEntryAttArchive)); |
2050 { |
2043 else |
2051 test_Equal((KEntryAttReadOnly|KEntryAttArchive), entry.iAtt); |
|
2052 } |
|
2053 else |
|
2054 { |
2044 test(entry.iAtt&KEntryAttReadOnly); // ??? |
2055 test(entry.iAtt&KEntryAttReadOnly); // ??? |
|
2056 } |
2045 entry=(*entryList)[1]; |
2057 entry=(*entryList)[1]; |
2046 test(entry.iName.MatchF(_L("ATTRIB2.AT"))!=KErrNotFound); |
2058 test(entry.iName.MatchF(_L("ATTRIB2.AT"))!=KErrNotFound); |
2047 if (!IsTestingLFFS()) |
2059 if (!IsTestingLFFS()) |
2048 test(entry.iAtt==(KEntryAttReadOnly|KEntryAttArchive)); |
2060 { |
2049 else |
2061 test_Equal((KEntryAttReadOnly|KEntryAttArchive), entry.iAtt); |
|
2062 } |
|
2063 else |
|
2064 { |
2050 test(entry.iAtt&KEntryAttReadOnly); // ??? |
2065 test(entry.iAtt&KEntryAttReadOnly); // ??? |
|
2066 } |
2051 entry=(*entryList)[2]; |
2067 entry=(*entryList)[2]; |
2052 test(entry.iName.MatchF(_L("SUBDIR"))!=KErrNotFound); |
2068 test(entry.iName.MatchF(_L("SUBDIR"))!=KErrNotFound); |
2053 delete entryList; |
2069 delete entryList; |
2054 |
2070 |
2055 scan->NextL(entryList); |
2071 scan->NextL(entryList); |
2056 count=entryList->Count(); |
2072 count=entryList->Count(); |
2057 test(count==1); |
2073 test_Equal(1, count); |
2058 entry=(*entryList)[0]; |
2074 entry=(*entryList)[0]; |
2059 test(entry.iName.MatchF(_L("ATFILE.TXT"))!=KErrNotFound); |
2075 test(entry.iName.MatchF(_L("ATFILE.TXT"))!=KErrNotFound); |
2060 if (!IsTestingLFFS()) |
2076 if (!IsTestingLFFS()) |
2061 test(entry.iAtt==(KEntryAttReadOnly|KEntryAttArchive)); |
2077 { |
2062 else |
2078 test_Equal((KEntryAttReadOnly|KEntryAttArchive), entry.iAtt); |
|
2079 } |
|
2080 else |
|
2081 { |
2063 test(entry.iAtt&KEntryAttReadOnly); // ??? |
2082 test(entry.iAtt&KEntryAttReadOnly); // ??? |
|
2083 } |
2064 delete entryList; |
2084 delete entryList; |
2065 |
2085 |
2066 scan->NextL(entryList); |
2086 scan->NextL(entryList); |
2067 test(entryList==NULL); |
2087 test(entryList==NULL); |
2068 |
2088 |
2069 if (!gAsynch) |
2089 if (!gAsynch) |
2070 { |
2090 { |
2071 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),0,KEntryAttReadOnly|KEntryAttArchive,TTime(0),CFileMan::ERecurse); |
2091 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),0,KEntryAttReadOnly|KEntryAttArchive,TTime(0),CFileMan::ERecurse); |
2072 test(r==KErrNone); |
2092 test_KErrNone(r); |
2073 } |
2093 } |
2074 else |
2094 else |
2075 { |
2095 { |
2076 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),0,KEntryAttReadOnly|KEntryAttArchive,TTime(0),CFileMan::ERecurse,gStat); |
2096 TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),0,KEntryAttReadOnly|KEntryAttArchive,TTime(0),CFileMan::ERecurse,gStat); |
2077 test(r==KErrNone); |
2097 test_KErrNone(r); |
2078 WaitForSuccess(); |
2098 WaitForSuccess(); |
2079 } |
2099 } |
2080 |
2100 |
2081 scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\*"),KEntryAttMaskSupported,ESortByName); |
2101 scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\*"),KEntryAttMaskSupported,ESortByName); |
2082 scan->NextL(entryList); |
2102 scan->NextL(entryList); |
2083 count=entryList->Count(); |
2103 count=entryList->Count(); |
2084 test(count==3); |
2104 test_Equal(3, count); |
2085 entry=(*entryList)[0]; |
2105 entry=(*entryList)[0]; |
2086 test(entry.iName.MatchF(_L("ATTRIB1.AT"))!=KErrNotFound); |
2106 test(entry.iName.MatchF(_L("ATTRIB1.AT"))!=KErrNotFound); |
2087 test(entry.iAtt==KEntryAttNormal); |
2107 test_Equal(KEntryAttNormal, entry.iAtt); |
2088 entry=(*entryList)[1]; |
2108 entry=(*entryList)[1]; |
2089 test(entry.iName.MatchF(_L("ATTRIB2.AT"))!=KErrNotFound); |
2109 test(entry.iName.MatchF(_L("ATTRIB2.AT"))!=KErrNotFound); |
2090 test(entry.iAtt==KEntryAttNormal); |
2110 test_Equal(KEntryAttNormal, entry.iAtt); |
2091 entry=(*entryList)[2]; |
2111 entry=(*entryList)[2]; |
2092 test(entry.iName.MatchF(_L("SUBDIR"))!=KErrNotFound); |
2112 test(entry.iName.MatchF(_L("SUBDIR"))!=KErrNotFound); |
2093 delete entryList; |
2113 delete entryList; |
2094 |
2114 |
2095 scan->NextL(entryList); |
2115 scan->NextL(entryList); |
2096 count=entryList->Count(); |
2116 count=entryList->Count(); |
2097 test(count==1); |
2117 test_Equal(1, count); |
2098 entry=(*entryList)[0]; |
2118 entry=(*entryList)[0]; |
2099 test(entry.iName.MatchF(_L("ATFILE.TXT"))!=KErrNotFound); |
2119 test(entry.iName.MatchF(_L("ATFILE.TXT"))!=KErrNotFound); |
2100 test(entry.iAtt==KEntryAttNormal); |
2120 test_Equal(KEntryAttNormal, entry.iAtt); |
2101 delete entryList; |
2121 delete entryList; |
2102 |
2122 |
2103 scan->NextL(entryList); |
2123 scan->NextL(entryList); |
2104 test(entryList==NULL); |
2124 test(entryList==NULL); |
2105 delete scan; |
2125 delete scan; |
2384 dst.Append(_L("ahsx\\")); |
2404 dst.Append(_L("ahsx\\")); |
2385 MakeDir(dst); |
2405 MakeDir(dst); |
2386 |
2406 |
2387 TEntry entry; |
2407 TEntry entry; |
2388 r = gFileMan->Move(src, KDest, 0); // ahsx\ah |
2408 r = gFileMan->Move(src, KDest, 0); // ahsx\ah |
2389 test(r == KErrNone); |
2409 test_KErrNone(r); |
2390 r = TheFs.Entry(src, entry); |
2410 r = TheFs.Entry(src, entry); |
2391 test(r == KErrNotFound); |
2411 test_Equal(KErrNotFound, r); |
2392 |
2412 |
2393 src.SetLength(src.Length()-1); // ahsx\a |
2413 src.SetLength(src.Length()-1); // ahsx\a |
2394 r = gFileMan->Move(src, KDest, 0); |
2414 r = gFileMan->Move(src, KDest, 0); |
2395 test(r == KErrNone); |
2415 test_KErrNone(r); |
2396 r = TheFs.Entry(src, entry); |
2416 r = TheFs.Entry(src, entry); |
2397 test(r == KErrNotFound); |
2417 test_Equal(KErrNotFound, r); |
2398 |
2418 |
2399 src.SetLength(src.Length()-3); // ahs |
2419 src.SetLength(src.Length()-3); // ahs |
2400 r = gFileMan->Move(src, KDest, 0); |
2420 r = gFileMan->Move(src, KDest, 0); |
2401 test(r == KErrNone); |
2421 test_KErrNone(r); |
2402 r = TheFs.Entry(src, entry); |
2422 r = TheFs.Entry(src, entry); |
2403 test(r == KErrNotFound); |
2423 test_Equal(KErrNotFound, r); |
2404 |
2424 |
2405 src.SetLength(src.Length()-1); // ah |
2425 src.SetLength(src.Length()-1); // ah |
2406 r = gFileMan->Move(src, KDest, 0); |
2426 r = gFileMan->Move(src, KDest, 0); |
2407 test(r == KErrAlreadyExists); |
2427 test_Equal(KErrAlreadyExists, r); |
2408 r = TheFs.Entry(src, entry); |
2428 r = TheFs.Entry(src, entry); |
2409 test(r == KErrNone); |
2429 test_KErrNone(r); |
2410 |
2430 |
2411 r = gFileMan->Move(src, KDest, CFileMan::EOverWrite); // ah |
2431 r = gFileMan->Move(src, KDest, CFileMan::EOverWrite); // ah |
2412 test(r == KErrNone); |
2432 test_KErrNone(r); |
2413 r = TheFs.Entry(src, entry); |
2433 r = TheFs.Entry(src, entry); |
2414 test(r == KErrNotFound); |
2434 test_Equal(KErrNotFound, r); |
2415 |
2435 |
2416 src.SetLength(src.Length()-1); // a |
2436 src.SetLength(src.Length()-1); // a |
2417 r = gFileMan->Move(src, KDest, 0); |
2437 r = gFileMan->Move(src, KDest, 0); |
2418 test(r == KErrAlreadyExists); |
2438 test_Equal(KErrAlreadyExists, r); |
2419 r = TheFs.Entry(src, entry); |
2439 r = TheFs.Entry(src, entry); |
2420 test(r == KErrNone); |
2440 test_KErrNone(r); |
2421 |
2441 |
2422 r = gFileMan->Move(src, KDest, CFileMan::EOverWrite); // a |
2442 r = gFileMan->Move(src, KDest, CFileMan::EOverWrite); // a |
2423 test(r == KErrNone); |
2443 test_KErrNone(r); |
2424 r = TheFs.Entry(src, entry); |
2444 r = TheFs.Entry(src, entry); |
2425 test(r == KErrNotFound); |
2445 test_Equal(KErrNotFound, r); |
2426 |
2446 |
2427 RmDir(source); |
2447 RmDir(source); |
2428 RmDir(KDest); |
2448 RmDir(KDest); |
2429 } |
2449 } |
2430 |
2450 |
2535 test.Next(_L("Test moving empty directories")); |
2555 test.Next(_L("Test moving empty directories")); |
2536 |
2556 |
2537 SetupDirectories(EFalse, NULL); |
2557 SetupDirectories(EFalse, NULL); |
2538 |
2558 |
2539 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
2559 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
2540 test(err == KErrNotFound); // Expected - directory is empty |
2560 test_Equal(KErrNotFound, err); // Expected - directory is empty |
2541 |
2561 |
2542 // Test that all directories are still present |
2562 // Test that all directories are still present |
2543 TEntry entry; |
2563 TEntry entry; |
2544 err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry); |
2564 err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry); |
2545 test(err == KErrNone); |
2565 test_KErrNone(err); |
2546 err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\dest\\"), entry); |
2566 err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\dest\\"), entry); |
2547 test(err == KErrNone); |
2567 test_KErrNone(err); |
2548 |
2568 |
2549 SetupDirectories(EFalse, NULL); |
2569 SetupDirectories(EFalse, NULL); |
2550 |
2570 |
2551 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
2571 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
2552 test(err == KErrNone); // Expected - should move (or rename) directory |
2572 test_KErrNone(err); // Expected - should move (or rename) directory |
2553 |
2573 |
2554 // Test directory has been moved |
2574 // Test directory has been moved |
2555 err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\dest\\source\\"), entry); |
2575 err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\dest\\source\\"), entry); |
2556 test(err == KErrNone); |
2576 test_KErrNone(err); |
2557 err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry); |
2577 err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry); |
2558 test(err == KErrNotFound); |
2578 test_Equal(KErrNotFound, err); |
2559 |
2579 |
2560 RmDir(_L("\\F32-TST\\TFMAN\\dest\\source\\")); |
2580 RmDir(_L("\\F32-TST\\TFMAN\\dest\\source\\")); |
2561 |
2581 |
2562 // |
2582 // |
2563 // Test moving when the source directory contains subdirectories (INC074828, INC078800) |
2583 // Test moving when the source directory contains subdirectories (INC074828, INC078800) |
2564 // |
2584 // |
2565 test.Next(_L("Test moving a directory containing subdirectories")); |
2585 test.Next(_L("Test moving a directory containing subdirectories")); |
2566 |
2586 |
2567 SetupDirectories(ETrue, NULL); |
2587 SetupDirectories(ETrue, NULL); |
2568 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse | CFileMan::EOverWrite); |
2588 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse | CFileMan::EOverWrite); |
2569 test(err == KErrNone); |
2589 test_KErrNone(err); |
2570 |
2590 |
2571 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
2591 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
2572 |
2592 |
2573 //--------------------------------------------- |
2593 //--------------------------------------------- |
2574 //! @SYMTestCaseID PBASE-T_FMAN-0160 |
2594 //! @SYMTestCaseID PBASE-T_FMAN-0160 |
2585 SetupDirectories(ETrue, NULL); |
2605 SetupDirectories(ETrue, NULL); |
2586 |
2606 |
2587 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
2607 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
2588 |
2608 |
2589 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
2609 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
2590 test(err == KErrNone); |
2610 test_KErrNone(err); |
2591 |
2611 |
2592 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
2612 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
2593 |
2613 |
2594 SetupDirectories(ETrue, NULL); |
2614 SetupDirectories(ETrue, NULL); |
2595 |
2615 |
2596 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
2616 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
2597 |
2617 |
2598 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest"), CFileMan::ERecurse); |
2618 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest"), CFileMan::ERecurse); |
2599 test(err == KErrNone); |
2619 test_KErrNone(err); |
2600 |
2620 |
2601 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
2621 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
2602 |
2622 |
2603 SetupDirectories(ETrue, NULL); |
2623 SetupDirectories(ETrue, NULL); |
2604 |
2624 |
2605 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
2625 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
2606 |
2626 |
2607 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
2627 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
2608 test(err == KErrNone); |
2628 test_KErrNone(err); |
2609 |
2629 |
2610 MakeDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\")); |
2630 MakeDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\")); |
2611 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*")); |
2631 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*")); |
2612 RmDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\")); |
2632 RmDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\")); |
2613 |
2633 |
2614 SetupDirectories(ETrue, NULL); |
2634 SetupDirectories(ETrue, NULL); |
2615 |
2635 |
2616 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
2636 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
2617 |
2637 |
2618 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
2638 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
2619 test(err == KErrNone); |
2639 test_KErrNone(err); |
2620 |
2640 |
2621 CheckFileExists(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), KErrNotFound, ETrue); |
2641 CheckFileExists(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), KErrNotFound, ETrue); |
2622 CheckFileExists(_L("\\F32-TST\\TFMAN\\dest\\File1.TXT"), KErrNone, ETrue); |
2642 CheckFileExists(_L("\\F32-TST\\TFMAN\\dest\\File1.TXT"), KErrNone, ETrue); |
2623 |
2643 |
2624 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
2644 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
2626 |
2646 |
2627 // Test behaviour for omitted parameters |
2647 // Test behaviour for omitted parameters |
2628 // For this, default should be session path |
2648 // For this, default should be session path |
2629 TFileName sessionPath; |
2649 TFileName sessionPath; |
2630 err=TheFs.SessionPath(sessionPath); |
2650 err=TheFs.SessionPath(sessionPath); |
2631 test(err==KErrNone); |
2651 test_KErrNone(err); |
2632 |
2652 |
2633 SetupDirectories(ETrue, NULL); |
2653 SetupDirectories(ETrue, NULL); |
2634 err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\dest\\")); |
2654 err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\dest\\")); |
2635 test(err == KErrNone); |
2655 test_KErrNone(err); |
2636 |
2656 |
2637 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L(""), CFileMan::ERecurse); |
2657 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L(""), CFileMan::ERecurse); |
2638 test(err == KErrNone); |
2658 test_KErrNone(err); |
2639 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*")); |
2659 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*")); |
2640 |
2660 |
2641 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
2661 RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
2642 RmDir(_L("\\F32-TST\\TFMAN\\source\\")); |
2662 RmDir(_L("\\F32-TST\\TFMAN\\source\\")); |
2643 SetupDirectories(ETrue, NULL); |
2663 SetupDirectories(ETrue, NULL); |
2644 err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\")); |
2664 err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\")); |
2645 test(err == KErrNone); |
2665 test_KErrNone(err); |
2646 |
2666 |
2647 err = gFileMan->Move(_L(""), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
2667 err = gFileMan->Move(_L(""), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
2648 test(err == KErrNone); |
2668 test_KErrNone(err); |
2649 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
2669 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
2650 |
2670 |
2651 err=TheFs.SetSessionPath(sessionPath); |
2671 err=TheFs.SetSessionPath(sessionPath); |
2652 test(err==KErrNone); |
2672 test_KErrNone(err); |
2653 |
2673 |
2654 //--------------------------------------------- |
2674 //--------------------------------------------- |
2655 //! @SYMTestCaseID PBASE-T_FMAN-0520 |
2675 //! @SYMTestCaseID PBASE-T_FMAN-0520 |
2656 //! @SYMTestType UT |
2676 //! @SYMTestType UT |
2657 //! @SYMREQ INC106735 |
2677 //! @SYMREQ INC106735 |
2940 // - This should fail, as 'dir12' already contains a directory called 'dir1' |
2960 // - This should fail, as 'dir12' already contains a directory called 'dir1' |
2941 // - No directories should be modified |
2961 // - No directories should be modified |
2942 // |
2962 // |
2943 |
2963 |
2944 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\complex\\dir1"), _L("\\F32-TST\\TFMAN\\complex\\dir12\\"), CFileMan::ERecurse); |
2964 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\complex\\dir1"), _L("\\F32-TST\\TFMAN\\complex\\dir12\\"), CFileMan::ERecurse); |
2945 test(err == KErrAlreadyExists); |
2965 test_Equal(KErrAlreadyExists, err); |
2946 |
2966 |
2947 for(level=0; level < KNumFilesResult1; level++) |
2967 for(level=0; level < KNumFilesResult1; level++) |
2948 { |
2968 { |
2949 err = TheFs.MkDirAll(complexResult1[level]); |
2969 err = TheFs.MkDirAll(complexResult1[level]); |
2950 test(err == KErrNone || err == KErrAlreadyExists); |
2970 test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
2951 |
2971 |
2952 RFile file; |
2972 RFile file; |
2953 err = file.Create(TheFs, complexResult1[level], EFileRead | EFileWrite); |
2973 err = file.Create(TheFs, complexResult1[level], EFileRead | EFileWrite); |
2954 test(err == KErrNone || err == KErrAlreadyExists || err == KErrBadName); |
2974 test_Value(err, err == KErrNone || err == KErrAlreadyExists || err == KErrBadName); |
2955 file.Close(); |
2975 file.Close(); |
2956 } |
2976 } |
2957 |
2977 |
2958 Compare(_L("\\F32-TST\\TFMAN\\complex_result1\\*"), _L("\\F32-TST\\TFMAN\\complex\\*")); |
2978 Compare(_L("\\F32-TST\\TFMAN\\complex_result1\\*"), _L("\\F32-TST\\TFMAN\\complex\\*")); |
2959 |
2979 |
2960 // |
2980 // |
2961 // Move directory 'dir1' into 'dir12' *with* overwrite flag set |
2981 // Move directory 'dir1' into 'dir12' *with* overwrite flag set |
2962 // |
2982 // |
2963 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\complex\\dir1"), _L("\\F32-TST\\TFMAN\\complex\\dir12\\"), CFileMan::ERecurse | CFileMan::EOverWrite); |
2983 err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\complex\\dir1"), _L("\\F32-TST\\TFMAN\\complex\\dir12\\"), CFileMan::ERecurse | CFileMan::EOverWrite); |
2964 test(err == KErrNone); |
2984 test_KErrNone(err); |
2965 |
2985 |
2966 for(level=0; level < KNumFilesResult2; level++) |
2986 for(level=0; level < KNumFilesResult2; level++) |
2967 { |
2987 { |
2968 err = TheFs.MkDirAll(complexResult2[level]); |
2988 err = TheFs.MkDirAll(complexResult2[level]); |
2969 test(err == KErrNone || err == KErrAlreadyExists); |
2989 test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
2970 |
2990 |
2971 RFile file; |
2991 RFile file; |
2972 err = file.Create(TheFs, complexResult2[level], EFileRead | EFileWrite); |
2992 err = file.Create(TheFs, complexResult2[level], EFileRead | EFileWrite); |
2973 test(err == KErrNone || err == KErrAlreadyExists || err == KErrBadName); |
2993 test_Value(err, err == KErrNone || err == KErrAlreadyExists || err == KErrBadName); |
2974 file.Close(); |
2994 file.Close(); |
2975 } |
2995 } |
2976 |
2996 |
2977 Compare(_L("\\F32-TST\\TFMAN\\complex_result2\\*"), _L("\\F32-TST\\TFMAN\\complex\\*")); |
2997 Compare(_L("\\F32-TST\\TFMAN\\complex_result2\\*"), _L("\\F32-TST\\TFMAN\\complex\\*")); |
2978 |
2998 |
3137 MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\FILE2.TXT"),contentsFile2); |
3157 MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\FILE2.TXT"),contentsFile2); |
3138 |
3158 |
3139 if (!gAsynch) |
3159 if (!gAsynch) |
3140 { |
3160 { |
3141 TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),0); |
3161 TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),0); |
3142 test(r==KErrAlreadyExists); |
3162 test_Equal(KErrAlreadyExists, r); |
3143 } |
3163 } |
3144 else |
3164 else |
3145 { |
3165 { |
3146 TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),0,gStat); |
3166 TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),0,gStat); |
3147 test(r==KErrNone); |
3167 test_KErrNone(r); |
3148 WaitForResult(KErrAlreadyExists); |
3168 WaitForResult(KErrAlreadyExists); |
3149 } |
3169 } |
3150 |
3170 |
3151 RFile f; |
3171 RFile f; |
3152 TInt r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT"),EFileRead); |
3172 TInt r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT"),EFileRead); |
3153 test(r==KErrNone); |
3173 test_KErrNone(r); |
3154 TBuf8<128> data; |
3174 TBuf8<128> data; |
3155 r=f.Read(data); |
3175 r=f.Read(data); |
3156 test(r==KErrNone); |
3176 test_KErrNone(r); |
3157 test(data.Length()==0); |
3177 test_Equal(0, data.Length()); |
3158 f.Close(); |
3178 f.Close(); |
3159 |
3179 |
3160 if (!gAsynch) |
3180 if (!gAsynch) |
3161 { |
3181 { |
3162 TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),CFileMan::EOverWrite); |
3182 TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),CFileMan::EOverWrite); |
3163 test(r==KErrNone); |
3183 test_KErrNone(r); |
3164 } |
3184 } |
3165 else |
3185 else |
3166 { |
3186 { |
3167 TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),CFileMan::EOverWrite,gStat); |
3187 TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),CFileMan::EOverWrite,gStat); |
3168 test(r==KErrNone); |
3188 test_KErrNone(r); |
3169 WaitForSuccess(); |
3189 WaitForSuccess(); |
3170 } |
3190 } |
3171 |
3191 |
3172 r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT"),EFileRead); |
3192 r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT"),EFileRead); |
3173 test(r==KErrNone); |
3193 test_KErrNone(r); |
3174 r=f.Read(data); |
3194 r=f.Read(data); |
3175 test(r==KErrNone); |
3195 test_KErrNone(r); |
3176 test(data==contentsFile1); |
3196 test(data==contentsFile1); |
3177 f.Close(); |
3197 f.Close(); |
3178 |
3198 |
3179 RmDir(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\")); |
3199 RmDir(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\")); |
3180 MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT")); |
3200 MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT")); |
3181 MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT")); |
3201 MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT")); |
3182 |
3202 |
3183 if (!gAsynch) |
3203 if (!gAsynch) |
3184 { |
3204 { |
3185 TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),0); |
3205 TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),0); |
3186 test(r==KErrAlreadyExists); |
3206 test_Equal(KErrAlreadyExists, r); |
3187 } |
3207 } |
3188 else |
3208 else |
3189 { |
3209 { |
3190 TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),0,gStat); |
3210 TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),0,gStat); |
3191 test(r==KErrNone); |
3211 test_KErrNone(r); |
3192 WaitForResult(KErrAlreadyExists); |
3212 WaitForResult(KErrAlreadyExists); |
3193 } |
3213 } |
3194 |
3214 |
3195 r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT"),EFileRead); |
3215 r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT"),EFileRead); |
3196 test(r==KErrNone); |
3216 test_KErrNone(r); |
3197 r=f.Read(data); |
3217 r=f.Read(data); |
3198 test(r==KErrNone); |
3218 test_KErrNone(r); |
3199 test(data.Length()==0); |
3219 test_Equal(0, data.Length()); |
3200 f.Close(); |
3220 f.Close(); |
3201 |
3221 |
3202 if (!gAsynch) |
3222 if (!gAsynch) |
3203 { |
3223 { |
3204 TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),CFileMan::EOverWrite); |
3224 TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),CFileMan::EOverWrite); |
3205 test(r==KErrNone); |
3225 test_KErrNone(r); |
3206 } |
3226 } |
3207 else |
3227 else |
3208 { |
3228 { |
3209 TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),CFileMan::EOverWrite,gStat); |
3229 TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),CFileMan::EOverWrite,gStat); |
3210 test(r==KErrNone); |
3230 test_KErrNone(r); |
3211 WaitForSuccess(); |
3231 WaitForSuccess(); |
3212 } |
3232 } |
3213 |
3233 |
3214 r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT"),EFileRead); |
3234 r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT"),EFileRead); |
3215 test(r==KErrNone); |
3235 test_KErrNone(r); |
3216 r=f.Read(data); |
3236 r=f.Read(data); |
3217 test(r==KErrNone); |
3237 test_KErrNone(r); |
3218 test(data==contentsFile2); |
3238 test(data==contentsFile2); |
3219 f.Close(); |
3239 f.Close(); |
3220 gFileMan->SetObserver(gObserver); |
3240 gFileMan->SetObserver(gObserver); |
3221 CleanupStack::PopAndDestroy(); |
3241 CleanupStack::PopAndDestroy(); |
3222 } |
3242 } |
3264 test.Next(_L("Test cyclic copy")); |
3284 test.Next(_L("Test cyclic copy")); |
3265 if (!gAsynch) |
3285 if (!gAsynch) |
3266 r=gFileMan->Copy(_L("\\ONE\\TWO\\*"),_L("\\ONE\\TWO\\THREE\\"),CFileMan::ERecurse); |
3286 r=gFileMan->Copy(_L("\\ONE\\TWO\\*"),_L("\\ONE\\TWO\\THREE\\"),CFileMan::ERecurse); |
3267 else |
3287 else |
3268 r=gFileMan->Copy(_L("\\ONE\\TWO\\*"),_L("\\ONE\\TWO\\THREE\\"),CFileMan::ERecurse,gStat); |
3288 r=gFileMan->Copy(_L("\\ONE\\TWO\\*"),_L("\\ONE\\TWO\\THREE\\"),CFileMan::ERecurse,gStat); |
3269 test(r==KErrArgument); |
3289 test_Equal(KErrArgument, r); |
3270 |
3290 |
3271 test.Next(_L("Test src name == trg name")); |
3291 test.Next(_L("Test src name == trg name")); |
3272 if (!gAsynch) |
3292 if (!gAsynch) |
3273 { |
3293 { |
3274 r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR")); // default aSwitch=EOverWrite |
3294 r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR")); // default aSwitch=EOverWrite |
3275 test(r==KErrNone); |
3295 test_KErrNone(r); |
3276 r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR"), 0); |
3296 r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR"), 0); |
3277 test(r==KErrAlreadyExists); |
3297 test_Equal(KErrAlreadyExists, r); |
3278 r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR"),CFileMan::ERecurse); |
3298 r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR"),CFileMan::ERecurse); |
3279 test(r==KErrAlreadyExists); |
3299 test_Equal(KErrAlreadyExists, r); |
3280 r=gFileMan->Copy(_L("\\ONE\\TWO\\F*R"),_L("\\ONE\\TWO\\FOUR"),CFileMan::ERecurse); |
3300 r=gFileMan->Copy(_L("\\ONE\\TWO\\F*R"),_L("\\ONE\\TWO\\FOUR"),CFileMan::ERecurse); |
3281 test(r==KErrAlreadyExists); |
3301 test_Equal(KErrAlreadyExists, r); |
3282 } |
3302 } |
3283 else |
3303 else |
3284 { |
3304 { |
3285 r=gFileMan->Copy(_L("\\ONE\\TWO\\*.TXT"),_L("\\ONE\\TWO\\*.TXT"),0,gStat); |
3305 r=gFileMan->Copy(_L("\\ONE\\TWO\\*.TXT"),_L("\\ONE\\TWO\\*.TXT"),0,gStat); |
3286 test(r==KErrNone); |
3306 test_KErrNone(r); |
3287 WaitForResult(KErrAlreadyExists); |
3307 WaitForResult(KErrAlreadyExists); |
3288 r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\F*R"),CFileMan::ERecurse,gStat); |
3308 r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\F*R"),CFileMan::ERecurse,gStat); |
3289 test(r==KErrNone); |
3309 test_KErrNone(r); |
3290 WaitForResult(KErrNone); |
3310 WaitForResult(KErrNone); |
3291 } |
3311 } |
3292 RmDir(_L("\\ONE\\")); |
3312 RmDir(_L("\\ONE\\")); |
3293 |
3313 |
3294 test.Next(_L("Test copy missing source and path")); |
3314 test.Next(_L("Test copy missing source and path")); |
3295 if (!gAsynch) |
3315 if (!gAsynch) |
3296 { |
3316 { |
3297 r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf")); |
3317 r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf")); |
3298 test(r==KErrPathNotFound); |
3318 test_Equal(KErrPathNotFound, r); |
3299 r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse); |
3319 r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse); |
3300 test(r==KErrPathNotFound); |
3320 test_Equal(KErrPathNotFound, r); |
3301 } |
3321 } |
3302 else |
3322 else |
3303 { |
3323 { |
3304 r=gFileMan->Copy(_L("\\ONE\\TWO\\*.TXT"),_L("\\ONE\\TWO\\*.YYY"),0,gStat); |
3324 r=gFileMan->Copy(_L("\\ONE\\TWO\\*.TXT"),_L("\\ONE\\TWO\\*.YYY"),0,gStat); |
3305 test(r==KErrNone); |
3325 test_KErrNone(r); |
3306 WaitForResult(KErrPathNotFound); |
3326 WaitForResult(KErrPathNotFound); |
3307 r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse,gStat); |
3327 r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse,gStat); |
3308 test(r==KErrNone); |
3328 test_KErrNone(r); |
3309 WaitForResult(KErrPathNotFound); |
3329 WaitForResult(KErrPathNotFound); |
3310 } |
3330 } |
3311 |
3331 |
3312 test.Next(_L("Test copy missing source")); |
3332 test.Next(_L("Test copy missing source")); |
3313 if (!gAsynch) |
3333 if (!gAsynch) |
3314 { |
3334 { |
3315 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\*.LPQ"),_L("\\ONE\\TWO\\*.YYY")); |
3335 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\*.LPQ"),_L("\\ONE\\TWO\\*.YYY")); |
3316 test(r==KErrNotFound); |
3336 test_Equal(KErrNotFound, r); |
3317 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse); |
3337 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse); |
3318 test(r==KErrNotFound); |
3338 test_Equal(KErrNotFound, r); |
3319 } |
3339 } |
3320 else |
3340 else |
3321 { |
3341 { |
3322 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),0,gStat); |
3342 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),0,gStat); |
3323 test(r==KErrNone); |
3343 test_KErrNone(r); |
3324 WaitForResult(KErrNotFound); |
3344 WaitForResult(KErrNotFound); |
3325 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse,gStat); |
3345 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse,gStat); |
3326 test(r==KErrNone); |
3346 test_KErrNone(r); |
3327 WaitForResult(KErrNotFound); |
3347 WaitForResult(KErrNotFound); |
3328 } |
3348 } |
3329 |
3349 |
3330 RmDir(_L("\\EMPTYSRC\\")); |
3350 RmDir(_L("\\EMPTYSRC\\")); |
3331 MakeDir(_L("\\EMPTYSRC\\")); |
3351 MakeDir(_L("\\EMPTYSRC\\")); |
3333 MakeDir(_L("\\EMPTYTRG\\")); |
3353 MakeDir(_L("\\EMPTYTRG\\")); |
3334 test.Next(_L("Test copy empty source directory")); |
3354 test.Next(_L("Test copy empty source directory")); |
3335 if (!gAsynch) |
3355 if (!gAsynch) |
3336 { |
3356 { |
3337 r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\")); |
3357 r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\")); |
3338 test(r==KErrNotFound); |
3358 test_Equal(KErrNotFound, r); |
3339 r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse); |
3359 r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse); |
3340 test(r==KErrNotFound); |
3360 test_Equal(KErrNotFound, r); |
3341 r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\")); |
3361 r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\")); |
3342 test(r==KErrNotFound); |
3362 test_Equal(KErrNotFound, r); |
3343 r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse); |
3363 r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse); |
3344 test(r==KErrNotFound); |
3364 test_Equal(KErrNotFound, r); |
3345 } |
3365 } |
3346 else |
3366 else |
3347 { |
3367 { |
3348 r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), 0, gStat); |
3368 r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), 0, gStat); |
3349 test(r==KErrNone); |
3369 test_KErrNone(r); |
3350 WaitForResult(KErrNotFound); |
3370 WaitForResult(KErrNotFound); |
3351 r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse, gStat); |
3371 r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse, gStat); |
3352 test(r==KErrNone); |
3372 test_KErrNone(r); |
3353 WaitForResult(KErrNotFound); |
3373 WaitForResult(KErrNotFound); |
3354 r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), 0, gStat); |
3374 r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), 0, gStat); |
3355 test(r==KErrNone); |
3375 test_KErrNone(r); |
3356 WaitForResult(KErrNotFound); |
3376 WaitForResult(KErrNotFound); |
3357 r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse, gStat); |
3377 r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse, gStat); |
3358 test(r==KErrNone); |
3378 test_KErrNone(r); |
3359 WaitForResult(KErrNotFound); |
3379 WaitForResult(KErrNotFound); |
3360 } |
3380 } |
3361 RmDir(_L("\\EMPTYSRC\\")); |
3381 RmDir(_L("\\EMPTYSRC\\")); |
3362 RmDir(_L("\\EMPTYTRG\\")); |
3382 RmDir(_L("\\EMPTYTRG\\")); |
3363 |
3383 |
3364 |
3384 |
3365 MakeFile(_L("Dummyfile")); |
3385 MakeFile(_L("Dummyfile")); |
3366 test.Next(_L("Test illegal names")); |
3386 test.Next(_L("Test illegal names")); |
3367 r=gFileMan->Attribs(_L(":C:"),0,0,TTime(0),0); |
3387 r=gFileMan->Attribs(_L(":C:"),0,0,TTime(0),0); |
3368 test(r==KErrBadName); |
3388 test_Equal(KErrBadName, r); |
3369 r=gFileMan->Copy(_L(":C:"),_L("newname"),0); |
3389 r=gFileMan->Copy(_L(":C:"),_L("newname"),0); |
3370 test(r==KErrBadName); |
3390 test_Equal(KErrBadName, r); |
3371 r=gFileMan->Copy(_L("Dummyfile"),_L(":C:"),0); |
3391 r=gFileMan->Copy(_L("Dummyfile"),_L(":C:"),0); |
3372 test(r==KErrBadName); |
3392 test_Equal(KErrBadName, r); |
3373 r=gFileMan->Delete(_L(":C:"),0); |
3393 r=gFileMan->Delete(_L(":C:"),0); |
3374 test(r==KErrBadName); |
3394 test_Equal(KErrBadName, r); |
3375 r=gFileMan->Move(_L(":C:"),_L("newname"),0); |
3395 r=gFileMan->Move(_L(":C:"),_L("newname"),0); |
3376 test(r==KErrBadName); |
3396 test_Equal(KErrBadName, r); |
3377 r=gFileMan->Move(_L("dummyFile"),_L(":C:"),0); |
3397 r=gFileMan->Move(_L("dummyFile"),_L(":C:"),0); |
3378 test(r==KErrBadName); |
3398 test_Equal(KErrBadName, r); |
3379 r=gFileMan->Rename(_L(":C:"),_L("newname"),0); |
3399 r=gFileMan->Rename(_L(":C:"),_L("newname"),0); |
3380 test(r==KErrBadName); |
3400 test_Equal(KErrBadName, r); |
3381 r=gFileMan->Rename(_L("DummyFile"),_L(":C:"),0); |
3401 r=gFileMan->Rename(_L("DummyFile"),_L(":C:"),0); |
3382 test(r==KErrBadName); |
3402 test_Equal(KErrBadName, r); |
3383 r=gFileMan->RmDir(_L("\\:C:\\")); |
3403 r=gFileMan->RmDir(_L("\\:C:\\")); |
3384 test(r==KErrBadName); |
3404 test_Equal(KErrBadName, r); |
3385 |
3405 |
3386 r=gFileMan->Attribs(_L("::C:"),0,0,TTime(0),0); |
3406 r=gFileMan->Attribs(_L("::C:"),0,0,TTime(0),0); |
3387 test(r==KErrBadName); |
3407 test_Equal(KErrBadName, r); |
3388 r=gFileMan->Copy(_L("::C:"),_L("newname"),0); |
3408 r=gFileMan->Copy(_L("::C:"),_L("newname"),0); |
3389 test(r==KErrBadName); |
3409 test_Equal(KErrBadName, r); |
3390 r=gFileMan->Copy(_L("Dummyfile"),_L("::C:"),0); |
3410 r=gFileMan->Copy(_L("Dummyfile"),_L("::C:"),0); |
3391 test(r==KErrBadName); |
3411 test_Equal(KErrBadName, r); |
3392 r=gFileMan->Delete(_L("::C:"),0); |
3412 r=gFileMan->Delete(_L("::C:"),0); |
3393 test(r==KErrBadName); |
3413 test_Equal(KErrBadName, r); |
3394 r=gFileMan->Move(_L("::C:"),_L("newname"),0); |
3414 r=gFileMan->Move(_L("::C:"),_L("newname"),0); |
3395 test(r==KErrBadName); |
3415 test_Equal(KErrBadName, r); |
3396 r=gFileMan->Move(_L("dummyFile"),_L("::C:"),0); |
3416 r=gFileMan->Move(_L("dummyFile"),_L("::C:"),0); |
3397 test(r==KErrBadName); |
3417 test_Equal(KErrBadName, r); |
3398 r=gFileMan->Rename(_L("::C:"),_L("newname"),0); |
3418 r=gFileMan->Rename(_L("::C:"),_L("newname"),0); |
3399 test(r==KErrBadName); |
3419 test_Equal(KErrBadName, r); |
3400 r=gFileMan->Rename(_L("DummyFile"),_L("::C:"),0); |
3420 r=gFileMan->Rename(_L("DummyFile"),_L("::C:"),0); |
3401 test(r==KErrBadName); |
3421 test_Equal(KErrBadName, r); |
3402 r=gFileMan->RmDir(_L("::C:")); |
3422 r=gFileMan->RmDir(_L("::C:")); |
3403 test(r==KErrBadName); |
3423 test_Equal(KErrBadName, r); |
3404 r=TheFs.Delete(_L("DummyFile")); |
3424 r=TheFs.Delete(_L("DummyFile")); |
3405 test(r==KErrNone); |
3425 test_KErrNone(r); |
3406 // test copying two files with identical names that do not exist |
3426 // test copying two files with identical names that do not exist |
3407 _LIT(KNonExistent,"\\azzzz.txt"); |
3427 _LIT(KNonExistent,"\\azzzz.txt"); |
3408 r=gFileMan->Copy(KNonExistent,KNonExistent,0); |
3428 r=gFileMan->Copy(KNonExistent,KNonExistent,0); |
3409 test(r==KErrNotFound); |
3429 test_Equal(KErrNotFound, r); |
3410 } |
3430 } |
3411 |
3431 |
3412 LOCAL_C void TestNameMangling() |
3432 LOCAL_C void TestNameMangling() |
3413 // |
3433 // |
3414 // Synchronous test of name mangling |
3434 // Synchronous test of name mangling |
3458 longFileNameA.Fill('A',longFileLength); |
3478 longFileNameA.Fill('A',longFileLength); |
3459 TFileName longRootDirNameA=_L("\\"); |
3479 TFileName longRootDirNameA=_L("\\"); |
3460 longRootDirNameA+=longFileNameA; |
3480 longRootDirNameA+=longFileNameA; |
3461 longRootDirNameA+=_L("\\"); |
3481 longRootDirNameA+=_L("\\"); |
3462 TInt r=TheFs.MkDir(longRootDirNameA); |
3482 TInt r=TheFs.MkDir(longRootDirNameA); |
3463 test(r==KErrNone || r==KErrAlreadyExists); |
3483 test_Value(r, r==KErrNone || r==KErrAlreadyExists); |
3464 // Second folder |
3484 // Second folder |
3465 TFileName longFileNameB; |
3485 TFileName longFileNameB; |
3466 longFileNameB.SetLength(longFileLength); |
3486 longFileNameB.SetLength(longFileLength); |
3467 longFileNameB.Fill('B',longFileLength); |
3487 longFileNameB.Fill('B',longFileLength); |
3468 TFileName longRootDirNameB=_L("\\"); |
3488 TFileName longRootDirNameB=_L("\\"); |
3469 longRootDirNameB+=longFileNameB; |
3489 longRootDirNameB+=longFileNameB; |
3470 longRootDirNameB+=_L("\\"); |
3490 longRootDirNameB+=_L("\\"); |
3471 r=TheFs.MkDir(longRootDirNameB); |
3491 r=TheFs.MkDir(longRootDirNameB); |
3472 test(r==KErrNone || r==KErrAlreadyExists); |
3492 test_Value(r, r==KErrNone || r==KErrAlreadyExists); |
3473 |
3493 |
3474 TInt longFilePtrLength = KMaxFileName-3; // We do not want the trailing backslash |
3494 TInt longFilePtrLength = KMaxFileName-3; // We do not want the trailing backslash |
3475 TPtrC ptrLongFileA(longRootDirNameA.Ptr(),longFilePtrLength); |
3495 TPtrC ptrLongFileA(longRootDirNameA.Ptr(),longFilePtrLength); |
3476 TPtrC ptrLongFileB(longRootDirNameB.Ptr(),longFilePtrLength); |
3496 TPtrC ptrLongFileB(longRootDirNameB.Ptr(),longFilePtrLength); |
3477 |
3497 |
3478 // TInt CFileMan::Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); |
3498 // TInt CFileMan::Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); |
3479 // Tries to move a folder with a long name into another |
3499 // Tries to move a folder with a long name into another |
3480 // This test will return KErrGeneral because the new path will exceed the maximum length |
3500 // This test will return KErrGeneral because the new path will exceed the maximum length |
3481 // See KMaxFileName |
3501 // See KMaxFileName |
3482 r=gFileMan->Move(ptrLongFileA,ptrLongFileB); |
3502 r=gFileMan->Move(ptrLongFileA,ptrLongFileB); |
3483 test(r==KErrGeneral); |
3503 test_Equal(KErrGeneral, r); |
3484 |
3504 |
3485 r=gFileMan->RmDir(longRootDirNameA); |
3505 r=gFileMan->RmDir(longRootDirNameA); |
3486 test(r==KErrNone); |
3506 test_KErrNone(r); |
3487 r=gFileMan->Rename(ptrLongFileB,ptrLongFileA); |
3507 r=gFileMan->Rename(ptrLongFileB,ptrLongFileA); |
3488 test(r==KErrNone); |
3508 test_KErrNone(r); |
3489 r=gFileMan->RmDir(longRootDirNameB); |
3509 r=gFileMan->RmDir(longRootDirNameB); |
3490 test(r==KErrPathNotFound); |
3510 test_Equal(KErrPathNotFound, r); |
3491 r=gFileMan->RmDir(longRootDirNameA); |
3511 r=gFileMan->RmDir(longRootDirNameA); |
3492 test(r==KErrNone); |
3512 test_KErrNone(r); |
3493 |
3513 |
3494 TFileName longSubDirName=_L("\\Files\\"); |
3514 TFileName longSubDirName=_L("\\Files\\"); |
3495 TPtrC longSubDirFileName(longFileNameA.Ptr(),longFilePtrLength-longSubDirName.Length()); |
3515 TPtrC longSubDirFileName(longFileNameA.Ptr(),longFilePtrLength-longSubDirName.Length()); |
3496 longSubDirName+=longSubDirFileName; |
3516 longSubDirName+=longSubDirFileName; |
3497 longSubDirName+=_L("\\"); |
3517 longSubDirName+=_L("\\"); |
3498 r=TheFs.MkDirAll(longSubDirName); |
3518 r=TheFs.MkDirAll(longSubDirName); |
3499 test(r==KErrNone); |
3519 test_KErrNone(r); |
3500 |
3520 |
3501 CDir* dirList; |
3521 CDir* dirList; |
3502 r=TheFs.GetDir(longSubDirName,KEntryAttMaskSupported,0,dirList); |
3522 r=TheFs.GetDir(longSubDirName,KEntryAttMaskSupported,0,dirList); |
3503 test(r==KErrNone); |
3523 test_KErrNone(r); |
3504 test(dirList->Count()==0); |
3524 test_Equal(0, dirList->Count()); |
3505 delete dirList; |
3525 delete dirList; |
3506 |
3526 |
3507 TPtrC ptrLongSubDirSrc(longSubDirName.Ptr(),longSubDirName.Length()-1); |
3527 TPtrC ptrLongSubDirSrc(longSubDirName.Ptr(),longSubDirName.Length()-1); |
3508 TPtrC ptrLongSubDirTrg(longRootDirNameA.Ptr(),longRootDirNameA.Length()-1); |
3528 TPtrC ptrLongSubDirTrg(longRootDirNameA.Ptr(),longRootDirNameA.Length()-1); |
3509 r=gFileMan->Copy(ptrLongSubDirSrc,ptrLongSubDirTrg); |
3529 r=gFileMan->Copy(ptrLongSubDirSrc,ptrLongSubDirTrg); |
3510 test(r==KErrNone); |
3530 test_KErrNone(r); |
3511 r=TheFs.MkDir(longRootDirNameB); |
3531 r=TheFs.MkDir(longRootDirNameB); |
3512 test(r==KErrNone); |
3532 test_KErrNone(r); |
3513 r=gFileMan->Move(ptrLongSubDirSrc,longRootDirNameB); |
3533 r=gFileMan->Move(ptrLongSubDirSrc,longRootDirNameB); |
3514 test(r==KErrBadName); |
3534 test_Equal(KErrBadName, r); |
3515 r=TheFs.RmDir(longRootDirNameB); |
3535 r=TheFs.RmDir(longRootDirNameB); |
3516 test(r==KErrNone); |
3536 test_KErrNone(r); |
3517 test(TheFs.RmDir(longSubDirName) == KErrNone); |
3537 test_KErrNone(TheFs.RmDir(longSubDirName)); |
3518 test(TheFs.RmDir(_L("\\Files\\")) == KErrNone); |
3538 test_KErrNone(TheFs.RmDir(_L("\\Files\\"))); |
3519 gFileMan->SetObserver(gObserver); |
3539 gFileMan->SetObserver(gObserver); |
3520 } |
3540 } |
3521 |
3541 |
3522 LOCAL_C void TestFileAttributes() |
3542 LOCAL_C void TestFileAttributes() |
3523 // |
3543 // |
3587 bufPtr.Set((TUint8*)contents.Ptr(),contents.Size()); |
3607 bufPtr.Set((TUint8*)contents.Ptr(),contents.Size()); |
3588 |
3608 |
3589 MakeFile(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),bufPtr); |
3609 MakeFile(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),bufPtr); |
3590 RFile f; |
3610 RFile f; |
3591 TInt r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),EFileRead|EFileShareReadersOnly); |
3611 TInt r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),EFileRead|EFileShareReadersOnly); |
3592 test(r==KErrNone); |
3612 test_KErrNone(r); |
3593 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx")); |
3613 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx")); |
3594 test(r==KErrNone); |
3614 test_KErrNone(r); |
3595 f.Close(); |
3615 f.Close(); |
3596 r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx"),EFileRead); |
3616 r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx"),EFileRead); |
3597 test(r==KErrNone); |
3617 test_KErrNone(r); |
3598 TBuf8<256*sizeof(TText)> temp; |
3618 TBuf8<256*sizeof(TText)> temp; |
3599 r=f.Read(temp); |
3619 r=f.Read(temp); |
3600 test(r==KErrNone); |
3620 test_KErrNone(r); |
3601 test(temp==bufPtr); |
3621 test(temp==bufPtr); |
3602 r=f.Read(temp); |
3622 r=f.Read(temp); |
3603 test(r==KErrNone); |
3623 test_KErrNone(r); |
3604 test(temp.Length()==0); |
3624 test_Equal(0, temp.Length()); |
3605 f.Close(); |
3625 f.Close(); |
3606 |
3626 |
3607 r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),EFileRead); |
3627 r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),EFileRead); |
3608 test(r==KErrNone); |
3628 test_KErrNone(r); |
3609 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx")); |
3629 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx")); |
3610 test(r==KErrInUse); |
3630 test_Equal(KErrInUse, r); |
3611 f.Close(); |
3631 f.Close(); |
3612 |
3632 |
3613 gFileMan->SetObserver(gObserver); |
3633 gFileMan->SetObserver(gObserver); |
3614 r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\FILECOPY\\")); |
3634 r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\FILECOPY\\")); |
3615 test(r==KErrNone); |
3635 test_KErrNone(r); |
3616 delete fManObserver; |
3636 delete fManObserver; |
3617 } |
3637 } |
3618 |
3638 |
3619 void TestINC101844() |
3639 void TestINC101844() |
3620 { |
3640 { |
3649 src.Append(_L("subdir1")); |
3669 src.Append(_L("subdir1")); |
3650 TheFs.SetAtt(src, KEntryAttSystem | KEntryAttHidden, KEntryAttArchive); |
3670 TheFs.SetAtt(src, KEntryAttSystem | KEntryAttHidden, KEntryAttArchive); |
3651 |
3671 |
3652 // Move directory containing files and subdirs with different attributes |
3672 // Move directory containing files and subdirs with different attributes |
3653 r = gFileMan->Move(source, KDest, 0); |
3673 r = gFileMan->Move(source, KDest, 0); |
3654 test(r==KErrNone); |
3674 test_KErrNone(r); |
3655 |
3675 |
3656 // Check that the files and subdirs have moved and have the correct attributes |
3676 // Check that the files and subdirs have moved and have the correct attributes |
3657 TEntry entry; |
3677 TEntry entry; |
3658 src = KDest; |
3678 src = KDest; |
3659 src.Append(_L("file1")); |
3679 src.Append(_L("file1")); |
3660 r = TheFs.Entry(src, entry); |
3680 r = TheFs.Entry(src, entry); |
3661 test(r == KErrNone); |
3681 test_KErrNone(r); |
3662 test(entry.iAtt&KEntryAttReadOnly); |
3682 test(entry.iAtt&KEntryAttReadOnly); |
3663 |
3683 |
3664 src = KDest; |
3684 src = KDest; |
3665 src.Append(_L("file2")); |
3685 src.Append(_L("file2")); |
3666 r = TheFs.Entry(src, entry); |
3686 r = TheFs.Entry(src, entry); |
3667 test(r == KErrNone); |
3687 test_KErrNone(r); |
3668 test(entry.iAtt&KEntryAttHidden); |
3688 test(entry.iAtt&KEntryAttHidden); |
3669 |
3689 |
3670 src = KDest; |
3690 src = KDest; |
3671 src.Append(_L("file3")); |
3691 src.Append(_L("file3")); |
3672 r = TheFs.Entry(src, entry); |
3692 r = TheFs.Entry(src, entry); |
3673 test(r == KErrNone); |
3693 test_KErrNone(r); |
3674 test(entry.iAtt&KEntryAttSystem); |
3694 test(entry.iAtt&KEntryAttSystem); |
3675 |
3695 |
3676 src = source; |
3696 src = source; |
3677 src.Append(_L("subdir1\\")); |
3697 src.Append(_L("subdir1\\")); |
3678 r = gFileMan->Move(src, source, 0); |
3698 r = gFileMan->Move(src, source, 0); |
3679 test(r == KErrNone); |
3699 test_KErrNone(r); |
3680 |
3700 |
3681 r = TheFs.RmDir(src); |
3701 r = TheFs.RmDir(src); |
3682 test(r==KErrNone); |
3702 test_KErrNone(r); |
3683 src = source; |
3703 src = source; |
3684 src.Append(_L("file4")); |
3704 src.Append(_L("file4")); |
3685 r = TheFs.Delete(src); |
3705 r = TheFs.Delete(src); |
3686 test(r==KErrNone); |
3706 test_KErrNone(r); |
3687 r = TheFs.RmDir(source); |
3707 r = TheFs.RmDir(source); |
3688 test(r==KErrNone); |
3708 test_KErrNone(r); |
3689 RmDir(KDest); |
3709 RmDir(KDest); |
3690 } |
3710 } |
3691 |
3711 |
3692 LOCAL_C void TestMoveAcrossDrives() |
3712 LOCAL_C void TestMoveAcrossDrives() |
3693 // |
3713 // |
3925 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO.TXT")); |
3945 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO.TXT")); |
3926 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO.GOD")); |
3946 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO.GOD")); |
3927 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO.BAD")); |
3947 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO.BAD")); |
3928 |
3948 |
3929 TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\TWO.*"), _L("\\F32-TST\\TFMAN\\THREE.*"), CFileMan::ERecurse); |
3949 TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\TWO.*"), _L("\\F32-TST\\TFMAN\\THREE.*"), CFileMan::ERecurse); |
3930 test(r==KErrNone); |
3950 test_KErrNone(r); |
3931 |
3951 |
3932 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.TXT"), KErrNone); |
3952 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.TXT"), KErrNone); |
3933 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.GOD"), KErrNone); |
3953 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.GOD"), KErrNone); |
3934 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.BAD"), KErrNone); |
3954 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.BAD"), KErrNone); |
3935 r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.*")); |
3955 r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.*")); |
3936 test(r==KErrNone); |
3956 test_KErrNone(r); |
3937 |
3957 |
3938 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__1.TXT")); |
3958 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__1.TXT")); |
3939 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__2.TXT")); |
3959 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__2.TXT")); |
3940 |
3960 |
3941 // copy and rename dir |
3961 // copy and rename dir |
3942 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE"), CFileMan::ERecurse); |
3962 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE"), CFileMan::ERecurse); |
3943 test(r==KErrNone); |
3963 test_KErrNone(r); |
3944 Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\*")); |
3964 Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\*")); |
3945 |
3965 |
3946 // copy and move into another dir |
3966 // copy and move into another dir |
3947 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO"), CFileMan::ERecurse); |
3967 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO"), CFileMan::ERecurse); |
3948 test(r==KErrNone); |
3968 test_KErrNone(r); |
3949 Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO\\*")); |
3969 Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO\\*")); |
3950 |
3970 |
3951 // copy and rename files and dirs in current dir |
3971 // copy and rename files and dirs in current dir |
3952 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE*"), CFileMan::ERecurse); |
3972 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE*"), CFileMan::ERecurse); |
3953 test(r==KErrNone); |
3973 test_KErrNone(r); |
3954 // Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE2\\*")); |
3974 // Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE2\\*")); |
3955 |
3975 |
3956 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\THREEO.TWO"), KErrNone); |
3976 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\THREEO.TWO"), KErrNone); |
3957 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO__1.TXT"), KErrNone); |
3977 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO__1.TXT"), KErrNone); |
3958 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO__2.TXT"), KErrNone); |
3978 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO__2.TXT"), KErrNone); |
4000 test.Printf(_L("Level:%d Available:%d\n"), aLevel, available); |
4020 test.Printf(_L("Level:%d Available:%d\n"), aLevel, available); |
4001 |
4021 |
4002 gFileMan->SetObserver(NULL); |
4022 gFileMan->SetObserver(NULL); |
4003 // Attribs |
4023 // Attribs |
4004 r = gFileMan->Attribs(KDir, 0, 0, 0, CFileMan::ERecurse); |
4024 r = gFileMan->Attribs(KDir, 0, 0, 0, CFileMan::ERecurse); |
4005 test(r==KErrNone); |
4025 test_KErrNone(r); |
4006 |
4026 |
4007 // Move |
4027 // Move |
4008 r = gFileMan->Move(KFile1, KFile2, CFileMan::ERecurse); |
4028 r = gFileMan->Move(KFile1, KFile2, CFileMan::ERecurse); |
4009 test(r==KErrAlreadyExists); |
4029 test_Equal(KErrAlreadyExists, r); |
4010 |
4030 |
4011 r = gFileMan->Move(KFile1, KFile2, CFileMan::ERecurse | CFileMan::EOverWrite); |
4031 r = gFileMan->Move(KFile1, KFile2, CFileMan::ERecurse | CFileMan::EOverWrite); |
4012 test(r==KErrNone); |
4032 test_KErrNone(r); |
4013 |
4033 |
4014 // Copy |
4034 // Copy |
4015 r = gFileMan->Copy(KFile2, KFile1, CFileMan::ERecurse); |
4035 r = gFileMan->Copy(KFile2, KFile1, CFileMan::ERecurse); |
4016 test(r==KErrNone); |
4036 test_KErrNone(r); |
4017 |
4037 |
4018 // Rename |
4038 // Rename |
4019 r = gFileMan->Rename(KFile1, KFile2, 0); |
4039 r = gFileMan->Rename(KFile1, KFile2, 0); |
4020 test(r==KErrAlreadyExists); |
4040 test_Equal(KErrAlreadyExists, r); |
4021 |
4041 |
4022 r = gFileMan->Rename(KFile1, KFile2, CFileMan::EOverWrite); |
4042 r = gFileMan->Rename(KFile1, KFile2, CFileMan::EOverWrite); |
4023 test(r==KErrNone); |
4043 test_KErrNone(r); |
4024 |
4044 |
4025 // Delete |
4045 // Delete |
4026 r = gFileMan->Delete(KFile2, CFileMan::ERecurse); |
4046 r = gFileMan->Delete(KFile2, CFileMan::ERecurse); |
4027 test(r==KErrNone); |
4047 test_KErrNone(r); |
4028 |
4048 |
4029 // RmDir |
4049 // RmDir |
4030 r = gFileMan->RmDir(KDir); |
4050 r = gFileMan->RmDir(KDir); |
4031 test(r==KErrNone); |
4051 test_KErrNone(r); |
4032 |
4052 |
4033 gFileMan->SetObserver(gObserver); |
4053 gFileMan->SetObserver(gObserver); |
4034 } |
4054 } |
4035 |
4055 |
4036 LOCAL_C void InitialiseL() |
4056 LOCAL_C void InitialiseL() |