395 |
393 |
396 oldName=KOldFile; |
394 oldName=KOldFile; |
397 oldName[0]=(TText)gDriveToTest; |
395 oldName[0]=(TText)gDriveToTest; |
398 |
396 |
399 r=TheFs.GetShortName(pritestfile, shortfilename); |
397 r=TheFs.GetShortName(pritestfile, shortfilename); |
400 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
398 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
401 |
399 |
402 r=TheFs.GetLongName(pritestfile1, longfilename); |
400 r=TheFs.GetLongName(pritestfile1, longfilename); |
403 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
401 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
404 |
402 |
405 r=file1.Create(TheFs,oldName,EFileWrite); |
403 r=file1.Create(TheFs,oldName,EFileWrite); |
406 test(r==KErrNone || r==KErrAlreadyExists); |
404 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
407 file1.Close(); |
405 file1.Close(); |
408 |
406 |
409 r=TheFs.Replace(oldName,pritestfile); |
407 r=TheFs.Replace(oldName,pritestfile); |
410 test(r==KErrNone); |
408 test_KErrNone(r); |
411 |
409 |
412 r=TheFs.Rename(pritestfile,pritestfile1); |
410 r=TheFs.Rename(pritestfile,pritestfile1); |
413 test(r==KErrNone || r==KErrAlreadyExists); |
411 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
414 |
412 |
415 r=TheFs.Entry(pritestfile1,entry); |
413 r=TheFs.Entry(pritestfile1,entry); |
416 test(r==KErrNone); |
414 test_KErrNone(r); |
417 |
415 |
418 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
416 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
419 test(r==KErrNone); |
417 test_KErrNone(r); |
420 |
418 |
421 r=TheFs.Delete(pritestfile1); |
419 r=TheFs.Delete(pritestfile1); |
422 test(r==KErrNone); |
420 test_KErrNone(r); |
423 } |
421 } |
424 |
422 |
425 |
423 |
426 LOCAL_C void systemRFiletest() |
424 LOCAL_C void systemRFiletest() |
427 // |
425 // |
428 //RFile testing with session path set to //system// |
426 //RFile testing with session path set to //system// |
429 // |
427 // |
430 { |
428 { |
431 |
429 |
432 r=TheFs.SetSessionPath(systestname); |
430 r=TheFs.SetSessionPath(systestname); |
433 test(r==KErrNone); |
431 test_KErrNone(r); |
434 |
432 |
435 r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite); |
433 r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite); |
436 test(r==KErrNone); |
434 test_KErrNone(r); |
437 file1.Close(); |
435 file1.Close(); |
438 |
436 |
439 r=file1.Create(TheFs,KFileSys,EFileWrite); |
437 r=file1.Create(TheFs,KFileSys,EFileWrite); |
440 test(r==KErrNone); |
438 test_KErrNone(r); |
441 file1.Close(); |
439 file1.Close(); |
442 |
440 |
443 r=file1.Open(TheFs,KFileSys,EFileWrite); |
441 r=file1.Open(TheFs,KFileSys,EFileWrite); |
444 test(r==KErrNone); |
442 test_KErrNone(r); |
445 file1.Close(); |
443 file1.Close(); |
446 |
444 |
447 r=file1.Open(TheFs,KFileSys,EFileRead); |
445 r=file1.Open(TheFs,KFileSys,EFileRead); |
448 test(r==KErrNone); |
446 test_KErrNone(r); |
449 file1.Close(); |
447 file1.Close(); |
450 |
448 |
451 r=file1.Replace(TheFs,KFileSys,EFileWrite); |
449 r=file1.Replace(TheFs,KFileSys,EFileWrite); |
452 test(r==KErrNone); |
450 test_KErrNone(r); |
453 |
451 |
454 r=file1.Rename(KFileSys3); |
452 r=file1.Rename(KFileSys3); |
455 test(r==KErrNone); |
453 test_KErrNone(r); |
456 file1.Close(); |
454 file1.Close(); |
457 |
455 |
458 TFindFile finder(TheFs); |
456 TFindFile finder(TheFs); |
459 CDir* dir = NULL; |
457 CDir* dir = NULL; |
460 r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
458 r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
461 if (!(r==KErrNone)) |
459 if (!(r==KErrNone)) |
462 test.Printf(_L("T_DCTCBALLFILES: test find wildcards r = %d (expected KErrNone)\n"), r); |
460 test.Printf(_L("T_DCTCBALLFILES: test find wildcards r = %d (expected KErrNone)\n"), r); |
463 test(r==KErrNone); |
461 test_KErrNone(r); |
464 delete dir; |
462 delete dir; |
465 } |
463 } |
466 |
464 |
467 LOCAL_C void resourceRFiletest() |
465 LOCAL_C void resourceRFiletest() |
468 // |
466 // |
469 //RFile testing with session path set to //resource// |
467 //RFile testing with session path set to //resource// |
470 // |
468 // |
471 { |
469 { |
472 r=TheFs.SetSessionPath(restestname); |
470 r=TheFs.SetSessionPath(restestname); |
473 test(r==KErrNone); |
471 test_KErrNone(r); |
474 |
472 |
475 r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite); |
473 r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite); |
476 test(r==KErrNone); |
474 test_KErrNone(r); |
477 file1.Close(); |
475 file1.Close(); |
478 |
476 |
479 r=file1.Create(TheFs,KFileRes,EFileWrite); |
477 r=file1.Create(TheFs,KFileRes,EFileWrite); |
480 test(r==KErrNone); |
478 test_KErrNone(r); |
481 file1.Close(); |
479 file1.Close(); |
482 |
480 |
483 r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive ); |
481 r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive ); |
484 test(r==KErrNone); |
482 test_KErrNone(r); |
485 |
483 |
486 r=file1.Rename(KFileRes3); |
484 r=file1.Rename(KFileRes3); |
487 test(r==KErrNone); |
485 test_KErrNone(r); |
488 file1.Close(); |
486 file1.Close(); |
489 |
487 |
490 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead); |
488 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead); |
491 test(r==KErrNone); |
489 test_KErrNone(r); |
492 file1.Close(); |
490 file1.Close(); |
493 |
491 |
494 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite); |
492 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite); |
495 test(r==KErrNone); |
493 test_KErrNone(r); |
496 file1.Close(); |
494 file1.Close(); |
497 |
495 |
498 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly); |
496 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly); |
499 test(r==KErrNone); |
497 test_KErrNone(r); |
500 |
498 |
501 r=file1.ChangeMode(EFileShareExclusive); |
499 r=file1.ChangeMode(EFileShareExclusive); |
502 test(r==KErrNone); |
500 test_KErrNone(r); |
503 file1.Close(); |
501 file1.Close(); |
504 |
502 |
505 r=file1.Replace(TheFs,KFileRes,EFileWrite); |
503 r=file1.Replace(TheFs,KFileRes,EFileWrite); |
506 test(r==KErrNone); |
504 test_KErrNone(r); |
507 file1.Close(); |
505 file1.Close(); |
508 } |
506 } |
509 |
507 |
510 |
508 |
511 LOCAL_C void privateRFiletest() |
509 LOCAL_C void privateRFiletest() |
512 // |
510 // |
513 //RFile testing with session path set to //Private// |
511 //RFile testing with session path set to //Private// |
514 // |
512 // |
515 { |
513 { |
516 r=TheFs.SetSessionPath(pritestfalseidname); |
514 r=TheFs.SetSessionPath(pritestfalseidname); |
517 test(r==KErrNone); |
515 test_KErrNone(r); |
518 |
516 |
519 r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite); |
517 r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite); |
520 test(r==KErrNone); |
518 test_KErrNone(r); |
521 file1.Close(); |
519 file1.Close(); |
522 |
520 |
523 r=file1.Create(TheFs,KFilePri,EFileWrite); |
521 r=file1.Create(TheFs,KFilePri,EFileWrite); |
524 test(r==KErrNone); |
522 test_KErrNone(r); |
525 file1.Close(); |
523 file1.Close(); |
526 |
524 |
527 r=file1.Open(TheFs,KFilePri,EFileWrite); |
525 r=file1.Open(TheFs,KFilePri,EFileWrite); |
528 test(r==KErrNone); |
526 test_KErrNone(r); |
529 file1.Close(); |
527 file1.Close(); |
530 |
528 |
531 r=file1.Open(TheFs,KFilePri,EFileRead); |
529 r=file1.Open(TheFs,KFilePri,EFileRead); |
532 test(r==KErrNone); |
530 test_KErrNone(r); |
533 file1.Close(); |
531 file1.Close(); |
534 |
532 |
535 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
533 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
536 test(r==KErrNone); |
534 test_KErrNone(r); |
537 |
535 |
538 r=file1.Rename(KFilePri3); |
536 r=file1.Rename(KFilePri3); |
539 test(r==KErrNone); |
537 test_KErrNone(r); |
540 file1.Close(); |
538 file1.Close(); |
541 } |
539 } |
542 |
540 |
543 |
541 |
544 LOCAL_C void privatefalseIDRFiletest() |
542 LOCAL_C void privatefalseIDRFiletest() |
545 // |
543 // |
546 //RFile testing with session path set to //Private// |
544 //RFile testing with session path set to //Private// |
547 // |
545 // |
548 { |
546 { |
549 r=TheFs.SetSessionPath(pritestname); |
547 r=TheFs.SetSessionPath(pritestname); |
550 test(r==KErrNone); |
548 test_KErrNone(r); |
551 |
549 |
552 r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); |
550 r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); |
553 test(r==KErrNone); |
551 test_KErrNone(r); |
554 file1.Close(); |
552 file1.Close(); |
555 |
553 |
556 r=file1.Create(TheFs,KFilePri,EFileWrite); |
554 r=file1.Create(TheFs,KFilePri,EFileWrite); |
557 test(r==KErrNone); |
555 test_KErrNone(r); |
558 file1.Close(); |
556 file1.Close(); |
559 |
557 |
560 r=file1.Open(TheFs,KFilePri,EFileWrite); |
558 r=file1.Open(TheFs,KFilePri,EFileWrite); |
561 test(r==KErrNone); |
559 test_KErrNone(r); |
562 file1.Close(); |
560 file1.Close(); |
563 |
561 |
564 r=file1.Open(TheFs,KFilePri,EFileRead); |
562 r=file1.Open(TheFs,KFilePri,EFileRead); |
565 test(r==KErrNone); |
563 test_KErrNone(r); |
566 file1.Close(); |
564 file1.Close(); |
567 |
565 |
568 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
566 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
569 test(r==KErrNone); |
567 test_KErrNone(r); |
570 |
568 |
571 r=file1.Rename(KFilePri3); |
569 r=file1.Rename(KFilePri3); |
572 test(r==KErrNone); |
570 test_KErrNone(r); |
573 file1.Close(); |
571 file1.Close(); |
574 } |
572 } |
575 |
573 |
576 |
574 |
577 LOCAL_C void privateSIDRFiletest() |
575 LOCAL_C void privateSIDRFiletest() |
578 // |
576 // |
579 //Rfile Testing with session path set to //Private//UID// |
577 //Rfile Testing with session path set to //Private//UID// |
580 // |
578 // |
581 { |
579 { |
582 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
580 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
583 test(r==KErrNone); |
581 test_KErrNone(r); |
584 |
582 |
585 r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
583 r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
586 test(r==KErrNone); |
584 test_KErrNone(r); |
587 file1.Close(); |
585 file1.Close(); |
588 |
586 |
589 r=file1.Create(TheFs,KFilePri,EFileWrite); |
587 r=file1.Create(TheFs,KFilePri,EFileWrite); |
590 test(r==KErrNone); |
588 test_KErrNone(r); |
591 file1.Close(); |
589 file1.Close(); |
592 |
590 |
593 r=file1.Open(TheFs,KFilePri,EFileWrite); |
591 r=file1.Open(TheFs,KFilePri,EFileWrite); |
594 test(r==KErrNone); |
592 test_KErrNone(r); |
595 file1.Close(); |
593 file1.Close(); |
596 |
594 |
597 r=file1.Open(TheFs,KFilePri,EFileRead); |
595 r=file1.Open(TheFs,KFilePri,EFileRead); |
598 test(r==KErrNone); |
596 test_KErrNone(r); |
599 file1.Close(); |
597 file1.Close(); |
600 |
598 |
601 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
599 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
602 test(r==KErrNone); |
600 test_KErrNone(r); |
603 |
601 |
604 r=file1.Rename(KFilePri3); |
602 r=file1.Rename(KFilePri3); |
605 test(r==KErrNone); |
603 test_KErrNone(r); |
606 file1.Close(); |
604 file1.Close(); |
607 } |
605 } |
608 |
606 |
609 LOCAL_C void RDirtest() |
607 LOCAL_C void RDirtest() |
610 // |
608 // |
615 //system |
613 //system |
616 CDir* dirEntries; |
614 CDir* dirEntries; |
617 TBuf<30> dirNameBuf(KSystemPath); |
615 TBuf<30> dirNameBuf(KSystemPath); |
618 dirNameBuf[0]=(TText)gDriveToTest; |
616 dirNameBuf[0]=(TText)gDriveToTest; |
619 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
617 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
620 test(r==KErrNone); |
618 test_KErrNone(r); |
621 dir.Close(); |
619 dir.Close(); |
622 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
620 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
623 test(r==KErrNone); |
621 test_KErrNone(r); |
624 dirNameBuf.Zero(); |
622 dirNameBuf.Zero(); |
625 delete dirEntries; |
623 delete dirEntries; |
626 |
624 |
627 //Private |
625 //Private |
628 dirNameBuf=KPrivatePath; |
626 dirNameBuf=KPrivatePath; |
629 dirNameBuf[0]=(TText)gDriveToTest; |
627 dirNameBuf[0]=(TText)gDriveToTest; |
630 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
628 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
631 test(r==KErrNone); |
629 test_KErrNone(r); |
632 dir.Close(); |
630 dir.Close(); |
633 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
631 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
634 test(r==KErrNone); |
632 test_KErrNone(r); |
635 dirNameBuf.Zero(); |
633 dirNameBuf.Zero(); |
636 delete dirEntries; |
634 delete dirEntries; |
637 |
635 |
638 //Private//false ID |
636 //Private//false ID |
639 dirNameBuf=KPrivateFalseID; |
637 dirNameBuf=KPrivateFalseID; |
640 dirNameBuf[0]=(TText)gDriveToTest; |
638 dirNameBuf[0]=(TText)gDriveToTest; |
641 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
639 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
642 test(r==KErrNone); |
640 test_KErrNone(r); |
643 dir.Close(); |
641 dir.Close(); |
644 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
642 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
645 test(r==KErrNone); |
643 test_KErrNone(r); |
646 dirNameBuf.Zero(); |
644 dirNameBuf.Zero(); |
647 delete dirEntries; |
645 delete dirEntries; |
648 |
646 |
649 //Private/uid |
647 //Private/uid |
650 TheFs.PrivatePath(dirNameBuf); |
648 TheFs.PrivatePath(dirNameBuf); |
651 dirNameBuf.Insert(0,_L("?:")); |
649 dirNameBuf.Insert(0,_L("?:")); |
652 dirNameBuf[0]=(TText)gDriveToTest; |
650 dirNameBuf[0]=(TText)gDriveToTest; |
653 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
651 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
654 test(r==KErrNone); |
652 test_KErrNone(r); |
655 dir.Close(); |
653 dir.Close(); |
656 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
654 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
657 test(r==KErrNone); |
655 test_KErrNone(r); |
658 dirNameBuf.Zero(); |
656 dirNameBuf.Zero(); |
659 delete dirEntries; |
657 delete dirEntries; |
660 //Resource |
658 //Resource |
661 dirNameBuf=KResourcePath; |
659 dirNameBuf=KResourcePath; |
662 dirNameBuf[0]=(TText)gDriveToTest; |
660 dirNameBuf[0]=(TText)gDriveToTest; |
663 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
661 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
664 test(r==KErrNone); |
662 test_KErrNone(r); |
665 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
663 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
666 test(r==KErrNone); |
664 test_KErrNone(r); |
667 dir.Close(); |
665 dir.Close(); |
668 delete dirEntries; |
666 delete dirEntries; |
669 } |
667 } |
670 |
668 |
671 |
669 |
843 TBuf<30> privatepath; |
841 TBuf<30> privatepath; |
844 r=TheFs.PrivatePath(privatepath); |
842 r=TheFs.PrivatePath(privatepath); |
845 test.Printf(_L("Private Path is=%S"),&privatepath); |
843 test.Printf(_L("Private Path is=%S"),&privatepath); |
846 |
844 |
847 r = TheFs.MkDir(_L("\\Caged\\")); |
845 r = TheFs.MkDir(_L("\\Caged\\")); |
848 test(r==KErrNone || r==KErrAlreadyExists); |
846 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
849 |
847 |
850 CDir* entryCount=NULL; |
848 CDir* entryCount=NULL; |
851 r=TheFs.GetDir(_L("\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount); |
849 r=TheFs.GetDir(_L("\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount); |
852 test(r==KErrNone); |
850 test_KErrNone(r); |
853 |
851 |
854 delete entryCount; |
852 delete entryCount; |
855 entryCount=NULL; |
853 entryCount=NULL; |
856 |
854 |
857 |
855 |
858 //Testing Copy |
856 //Testing Copy |
859 CDir* entryCount2=NULL; |
857 CDir* entryCount2=NULL; |
860 r=fMan->Copy(_L("\\sys\\"),_L("\\Caged\\")); |
858 r=fMan->Copy(_L("\\sys\\"),_L("\\Caged\\")); |
861 test(r == KErrNone); |
859 test_KErrNone(r); |
862 r=fMan->Copy(_L("\\*"),_L("\\Caged\\")); |
860 r=fMan->Copy(_L("\\*"),_L("\\Caged\\")); |
863 test(r == KErrNone); |
861 test_KErrNone(r); |
864 |
862 |
865 r=TheFs.GetDir(_L("\\Caged\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount2); |
863 r=TheFs.GetDir(_L("\\Caged\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount2); |
866 test(r==KErrNone); |
864 test_KErrNone(r); |
867 |
865 |
868 delete entryCount2; |
866 delete entryCount2; |
869 entryCount2=NULL; |
867 entryCount2=NULL; |
870 |
868 |
871 r=fMan->Copy(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); |
869 r=fMan->Copy(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); |
872 test(r == KErrPathNotFound); |
870 test_Value(r, r == KErrPathNotFound); |
873 |
871 |
874 // Create a test file |
872 // Create a test file |
875 RFile testFile; |
873 RFile testFile; |
876 r = testFile.Replace(TheFs, _L("\\capTest"),EFileWrite); |
874 r = testFile.Replace(TheFs, _L("\\capTest"),EFileWrite); |
877 test(r==KErrNone || r==KErrAlreadyExists); |
875 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
878 testFile.Close(); |
876 testFile.Close(); |
879 |
877 |
880 TFileName name; |
878 TFileName name; |
881 name = privatepath; |
879 name = privatepath; |
882 name.Append(_L("privateFile.tst")); |
880 name.Append(_L("privateFile.tst")); |
883 RFile privateFile; |
881 RFile privateFile; |
884 r = privateFile.Replace(TheFs, name,EFileWrite); |
882 r = privateFile.Replace(TheFs, name,EFileWrite); |
885 test(r==KErrNone || r==KErrAlreadyExists); |
883 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
886 privateFile.Close(); |
884 privateFile.Close(); |
887 |
885 |
888 |
886 |
889 r=fMan->Copy(_L("\\capTest"),_L("\\private\\two\\moo")); |
887 r=fMan->Copy(_L("\\capTest"),_L("\\private\\two\\moo")); |
890 test(r == KErrPathNotFound); |
888 test_Value(r, r == KErrPathNotFound); |
891 r=fMan->Copy(_L("\\capTest"),_L("\\sys\\bin\\moo")); |
889 r=fMan->Copy(_L("\\capTest"),_L("\\sys\\bin\\moo")); |
892 test(r == KErrPathNotFound); |
890 test_Value(r, r == KErrPathNotFound); |
893 r=fMan->Copy(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo")); |
891 r=fMan->Copy(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo")); |
894 test(r == KErrPathNotFound); |
892 test_Value(r, r == KErrPathNotFound); |
895 r=fMan->Copy(_L("\\capTest"),_L("\\sys\\capTest")); |
893 r=fMan->Copy(_L("\\capTest"),_L("\\sys\\capTest")); |
896 test(r == KErrNone || r==KErrAlreadyExists); |
894 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
897 r=fMan->Copy(_L("\\sys\\*"),_L("\\")); |
895 r=fMan->Copy(_L("\\sys\\*"),_L("\\")); |
898 test (r==KErrNone); |
896 test_KErrNone(r); |
899 r=fMan->Copy(name,_L("\\sys\\")); |
897 r=fMan->Copy(name,_L("\\sys\\")); |
900 test(r==KErrNone); |
898 test_KErrNone(r); |
901 |
899 |
902 // Testing Attribs |
900 // Testing Attribs |
903 r=fMan->Attribs(_L("\\private\\two\\moo"),KEntryAttReadOnly,0,TTime(0)); |
901 r=fMan->Attribs(_L("\\private\\two\\moo"),KEntryAttReadOnly,0,TTime(0)); |
904 test(r == KErrPathNotFound); |
902 test_Value(r, r == KErrPathNotFound); |
905 r=fMan->Attribs(_L("\\private\\moo"),KEntryAttReadOnly,0,TTime(0)); |
903 r=fMan->Attribs(_L("\\private\\moo"),KEntryAttReadOnly,0,TTime(0)); |
906 test(r == KErrNotFound); |
904 test_Value(r, r == KErrNotFound); |
907 r=fMan->Attribs(name,KEntryAttReadOnly,0,TTime(0)); |
905 r=fMan->Attribs(name,KEntryAttReadOnly,0,TTime(0)); |
908 test(r == KErrNone); |
906 test_KErrNone(r); |
909 r=fMan->Attribs(name,0,KEntryAttReadOnly,TTime(0)); |
907 r=fMan->Attribs(name,0,KEntryAttReadOnly,TTime(0)); |
910 test(r == KErrNone); |
908 test_KErrNone(r); |
911 |
909 |
912 // Testing Move |
910 // Testing Move |
913 r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo")); |
911 r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo")); |
914 test(r == KErrPathNotFound); |
912 test_Value(r, r == KErrPathNotFound); |
915 r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo")); |
913 r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo")); |
916 test(r == KErrPathNotFound); |
914 test_Value(r, r == KErrPathNotFound); |
917 r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo..")); |
915 r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo..")); |
918 test(r == KErrPathNotFound); |
916 test_Value(r, r == KErrPathNotFound); |
919 r=fMan->Move(name,_L("\\privateFile.tst")); |
917 r=fMan->Move(name,_L("\\privateFile.tst")); |
920 test(r == KErrNone); |
918 test_KErrNone(r); |
921 r=fMan->Move(_L("\\privateFile.tst"),name); |
919 r=fMan->Move(_L("\\privateFile.tst"),name); |
922 test(r == KErrNone); |
920 test_KErrNone(r); |
923 |
921 |
924 |
922 |
925 // Testing RmDir |
923 // Testing RmDir |
926 r=fMan->RmDir(_L("\\private\\")); |
924 r=fMan->RmDir(_L("\\private\\")); |
927 test(r == KErrNone); |
925 test_KErrNone(r); |
928 // put it back where it was |
926 // put it back where it was |
929 r = TheFs.MkDirAll(_L("\\private\\00000001\\")); |
927 r = TheFs.MkDirAll(_L("\\private\\00000001\\")); |
930 test(r == KErrNone); |
928 test_KErrNone(r); |
931 r=fMan->RmDir(_L("\\private\\two\\")); |
929 r=fMan->RmDir(_L("\\private\\two\\")); |
932 test(r == KErrPathNotFound); |
930 test_Value(r, r == KErrPathNotFound); |
933 r=fMan->RmDir(_L("\\private\\tw?\\")); |
931 r=fMan->RmDir(_L("\\private\\tw?\\")); |
934 test(r == KErrBadName); |
932 test_Value(r, r == KErrBadName); |
935 |
933 |
936 r=fMan->RmDir(_L("\\private\\two\\")); |
934 r=fMan->RmDir(_L("\\private\\two\\")); |
937 test(r == KErrPathNotFound); |
935 test_Value(r, r == KErrPathNotFound); |
938 r=fMan->RmDir(_L("\\private\\tw?\\")); |
936 r=fMan->RmDir(_L("\\private\\tw?\\")); |
939 test(r == KErrBadName); |
937 test_Value(r, r == KErrBadName); |
940 |
938 |
941 |
939 |
942 // Testing Rename |
940 // Testing Rename |
943 r=fMan->Rename(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); |
941 r=fMan->Rename(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); |
944 test(r == KErrPathNotFound); |
942 test_Value(r, r == KErrPathNotFound); |
945 |
943 |
946 // Testing Delete |
944 // Testing Delete |
947 r=fMan->Delete(_L("\\private\\two\\test")); |
945 r=fMan->Delete(_L("\\private\\two\\test")); |
948 test(r == KErrPathNotFound); |
946 test_Value(r, r == KErrPathNotFound); |
949 r=fMan->Delete(_L("\\private\\moo")); |
947 r=fMan->Delete(_L("\\private\\moo")); |
950 test(r == KErrNotFound); |
948 test_Value(r, r == KErrNotFound); |
951 |
949 |
952 //Something that actually exists in Private |
950 //Something that actually exists in Private |
953 r=fMan->Rename(name,_L("\\private\\00000001\\moo")); |
951 r=fMan->Rename(name,_L("\\private\\00000001\\moo")); |
954 test(r == KErrNotFound); |
952 test_Value(r, r == KErrNotFound); |
955 r=fMan->Rename(_L("\\private\\00000001\\moo"),name); |
953 r=fMan->Rename(_L("\\private\\00000001\\moo"),name); |
956 test(r == KErrNotFound); |
954 test_Value(r, r == KErrNotFound); |
957 r=fMan->Copy(name,_L("\\private\\00000001\\moo")); |
955 r=fMan->Copy(name,_L("\\private\\00000001\\moo")); |
958 test(r == KErrNotFound); |
956 test_Value(r, r == KErrNotFound); |
959 r=fMan->Delete(_L("\\private\\00000001\\moo")); |
957 r=fMan->Delete(_L("\\private\\00000001\\moo")); |
960 test(r == KErrNotFound); |
958 test_Value(r, r == KErrNotFound); |
961 |
959 |
962 // Clean up the test data |
960 // Clean up the test data |
963 r=fMan->RmDir(_L("\\Caged\\")); |
961 r=fMan->RmDir(_L("\\Caged\\")); |
964 test(r == KErrNone); |
962 test_KErrNone(r); |
965 r=fMan->Delete(_L("\\capTest")); |
963 r=fMan->Delete(_L("\\capTest")); |
966 test(r == KErrNone); |
964 test_KErrNone(r); |
967 delete(fMan); |
965 delete(fMan); |
968 } |
966 } |
969 |
967 |
970 // CDirScan tests |
968 // CDirScan tests |
971 ScanDir(_L("\\"), CDirScan::EScanUpTree, KErrNone); |
969 ScanDir(_L("\\"), CDirScan::EScanUpTree, KErrNone); |
1006 TBuf<30> sesspath; |
1004 TBuf<30> sesspath; |
1007 sesspath=_L("?:\\"); |
1005 sesspath=_L("?:\\"); |
1008 sesspath[0] = (TText)gDriveToTest; |
1006 sesspath[0] = (TText)gDriveToTest; |
1009 |
1007 |
1010 TInt r= TheFs.SetSessionPath(sesspath); |
1008 TInt r= TheFs.SetSessionPath(sesspath); |
1011 test(r==KErrNone); |
1009 test_KErrNone(r); |
1012 |
1010 |
1013 //cleanup from previous run of this test |
1011 //cleanup from previous run of this test |
1014 TBuf<20> delDir; |
1012 TBuf<20> delDir; |
1015 CFileMan* fMan=CFileMan::NewL(TheFs); |
1013 CFileMan* fMan=CFileMan::NewL(TheFs); |
1016 delDir=KResourcePath; |
1014 delDir=KResourcePath; |
1017 delDir[0]=(TText)gDriveToTest; |
1015 delDir[0]=(TText)gDriveToTest; |
1018 r=fMan->RmDir(delDir); |
1016 r=fMan->RmDir(delDir); |
1019 test(r==KErrNone || KErrNotFound); |
1017 test_Value(r, r == KErrNone || r == KErrNotFound || r == KErrPathNotFound); |
1020 delDir=KSystemPath; |
1018 delDir=KSystemPath; |
1021 delDir[0]=(TText)gDriveToTest; |
1019 delDir[0]=(TText)gDriveToTest; |
1022 r=fMan->RmDir(delDir); |
1020 r=fMan->RmDir(delDir); |
1023 test(r==KErrNone || KErrNotFound); |
1021 test_Value(r, r == KErrNone || r == KErrNotFound || r == KErrPathNotFound); |
1024 delDir=KPrivatePath; |
1022 delDir=KPrivatePath; |
1025 delDir[0]=(TText)gDriveToTest; |
1023 delDir[0]=(TText)gDriveToTest; |
1026 r=fMan->RmDir(delDir); |
1024 r=fMan->RmDir(delDir); |
1027 test(r==KErrNone || KErrNotFound); |
1025 test_Value(r, r == KErrNone || r == KErrNotFound || r == KErrPathNotFound); |
1028 delete fMan; |
1026 delete fMan; |
1029 |
1027 |
1030 //check double mode ie that Defpath still works |
1028 //check double mode ie that Defpath still works |
1031 RFs fs1; |
1029 RFs fs1; |
1032 RFs fs2; |
1030 RFs fs2; |
1033 |
1031 |
1034 r=fs1.Connect(); |
1032 r=fs1.Connect(); |
1035 test(r==KErrNone); |
1033 test_KErrNone(r); |
1036 r=fs1.SessionPath(sesspath); |
1034 r=fs1.SessionPath(sesspath); |
1037 test(r==KErrNone); |
1035 test_KErrNone(r); |
1038 test.Printf(_L("session1 Path=%S"),&sesspath); |
1036 test.Printf(_L("session1 Path=%S"),&sesspath); |
1039 |
1037 |
1040 TBuf<30> privatepath; |
1038 TBuf<30> privatepath; |
1041 r=fs1.SetSessionToPrivate(gTheDriveNum); |
1039 r=fs1.SetSessionToPrivate(gTheDriveNum); |
1042 test(r==KErrNone); |
1040 test_KErrNone(r); |
1043 r=fs1.PrivatePath(privatepath); |
1041 r=fs1.PrivatePath(privatepath); |
1044 test(r==KErrNone); |
1042 test_KErrNone(r); |
1045 r=privatepath.Compare(KExpectedPrivatePath()); |
1043 r=privatepath.Compare(KExpectedPrivatePath()); |
1046 test(r==0); |
1044 test_Value(r, r == 0); |
1047 r=fs1.SessionPath(sesspath); |
1045 r=fs1.SessionPath(sesspath); |
1048 test(r==KErrNone); |
1046 test_KErrNone(r); |
1049 r=privatepath.Compare(sesspath.Mid(KPathPosition)); |
1047 r=privatepath.Compare(sesspath.Mid(KPathPosition)); |
1050 test(r==0); |
1048 test_Value(r, r == 0); |
1051 r=fs1.CreatePrivatePath(gTheDriveNum); |
1049 r=fs1.CreatePrivatePath(gTheDriveNum); |
1052 test(r==KErrNone); |
1050 test_KErrNone(r); |
1053 fs1.Close(); |
1051 fs1.Close(); |
1054 |
1052 |
1055 r=fs2.Connect(); |
1053 r=fs2.Connect(); |
1056 test(r==KErrNone); |
1054 test_KErrNone(r); |
1057 r=fs2.SessionPath(sesspath); |
1055 r=fs2.SessionPath(sesspath); |
1058 test(r==KErrNone); |
1056 test_KErrNone(r); |
1059 test.Printf(_L("session2 Path=%S"),&sesspath); |
1057 test.Printf(_L("session2 Path=%S"),&sesspath); |
1060 fs2.Close(); |
1058 fs2.Close(); |
1061 |
1059 |
1062 TestCaps(); |
1060 TestCaps(); |
1063 TestCaging(); |
1061 TestCaging(); |