kerneltest/f32test/server/t_fman.cpp
branchRCL_3
changeset 80 597aaf25e343
parent 31 56f325a607ea
child 109 b3a1d9898418
child 189 a5496987b1da
child 249 a179b74831c9
equal deleted inserted replaced
62:4a8fed1c0ef6 80:597aaf25e343
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
       
    16 #define __E32TEST_EXTENSION__
       
    17 
    16 #include <f32file.h>
    18 #include <f32file.h>
    17 #include <e32test.h>
    19 #include <e32test.h>
    18 #include <hal.h>
    20 #include <hal.h>
    19 #include "t_server.h"
    21 #include "t_server.h"
    20 #include "t_chlffs.h"
    22 #include "t_chlffs.h"
    55 	if (lastError!=KErrNone && lastError!=KErrBadName)
    57 	if (lastError!=KErrNone && lastError!=KErrBadName)
    56 		{
    58 		{
    57 		TFileName fileName=iFileMan->CurrentEntry().iName;
    59 		TFileName fileName=iFileMan->CurrentEntry().iName;
    58 		if (gAsynch==EFalse)
    60 		if (gAsynch==EFalse)
    59 			test.Printf(_L("CurrentEntry is %S\n"),&fileName);
    61 			test.Printf(_L("CurrentEntry is %S\n"),&fileName);
    60 		test(lastError==KErrAlreadyExists);
    62 		test_Equal(KErrAlreadyExists, lastError);
    61 		test(fileName.MatchF(_L("PIPE1.PLP"))!=KErrNotFound || fileName.MatchF(_L("FOUR"))!=KErrNotFound || fileName.MatchF(_L("File*.TXT"))!=KErrNotFound  || fileName.MatchF(_L("ah"))!=KErrNotFound || fileName.MatchF(_L("a"))!=KErrNotFound);
    63 		test_Value(KErrNotFound, fileName.MatchF(_L("PIPE1.PLP"))!=KErrNotFound || fileName.MatchF(_L("FOUR"))!=KErrNotFound || fileName.MatchF(_L("File*.TXT"))!=KErrNotFound  || fileName.MatchF(_L("ah"))!=KErrNotFound || fileName.MatchF(_L("a"))!=KErrNotFound);
    62 		}
    64 		}
    63 	return(MFileManObserver::EContinue);
    65 	return(MFileManObserver::EContinue);
    64 	}
    66 	}
    65 
    67 
    66 LOCAL_C void WaitForSuccess()
    68 LOCAL_C void WaitForSuccess()
    76 //
    78 //
    77 // Wait for gStat to complete with aResult
    79 // Wait for gStat to complete with aResult
    78 //
    80 //
    79 	{
    81 	{
    80 	User::WaitForRequest(gStat);
    82 	User::WaitForRequest(gStat);
    81 	test(gStat==aResult);
    83 	test_Value(aResult, gStat==aResult);
    82 	}
    84 	}
    83 
    85 
    84 LOCAL_C void TestResult(TInt aReturnVal, TInt aExpectedAsynchReturnStatus=KErrNone, TInt aExpectedSynchReturn=KErrNone)
    86 LOCAL_C void TestResult(TInt aReturnVal, TInt aExpectedAsynchReturnStatus=KErrNone, TInt aExpectedSynchReturn=KErrNone)
    85 //
    87 //
    86 // Test the result, wait for an asynchronous call
    88 // Test the result, wait for an asynchronous call
    87 //
    89 //
    88 	{
    90 	{
    89 	if (!gAsynch)
    91 	if (!gAsynch)
    90 		test(aReturnVal==aExpectedAsynchReturnStatus);
    92 		{
    91 	else
    93 		test_Equal(aExpectedAsynchReturnStatus, aReturnVal);
    92 		{
    94 		}
    93 		test(aReturnVal==aExpectedSynchReturn);
    95 	else
       
    96 		{
       
    97 		test_Equal(aExpectedSynchReturn, aReturnVal);
    94 		WaitForResult(aExpectedAsynchReturnStatus);
    98 		WaitForResult(aExpectedAsynchReturnStatus);
    95 		}
    99 		}
    96 	}
   100 	}
    97 
   101 
    98 LOCAL_C void RmDir(const TDesC& aDirName)
   102 LOCAL_C void RmDir(const TDesC& aDirName)
   100 // Remove a directory
   104 // Remove a directory
   101 //
   105 //
   102 	{
   106 	{
   103 	gFileMan->Attribs(aDirName, 0, KEntryAttReadOnly, 0, CFileMan::ERecurse);
   107 	gFileMan->Attribs(aDirName, 0, KEntryAttReadOnly, 0, CFileMan::ERecurse);
   104 	TInt r=gFileMan->RmDir(aDirName);
   108 	TInt r=gFileMan->RmDir(aDirName);
   105 	test(r==KErrNone || r==KErrNotFound || r==KErrPathNotFound);
   109 	test_Value(r, r==KErrNone || r==KErrNotFound || r==KErrPathNotFound);
   106 	}
   110 	}
   107 
   111 
   108 LOCAL_C void Compare(const TDesC& aDir1,const TDesC& aDir2)
   112 LOCAL_C void Compare(const TDesC& aDir1,const TDesC& aDir2)
   109 //
   113 //
   110 // Test that the contents of two directories are identical
   114 // Test that the contents of two directories are identical
   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;
   202 			name.AppendNum(i);
   206 			name.AppendNum(i);
   203 			name.Append(_L(".TXT"));
   207 			name.Append(_L(".TXT"));
   204 
   208 
   205 			RFile file;
   209 			RFile file;
   206 			err = file.Create(TheFs,name,EFileRead|EFileWrite);
   210 			err = file.Create(TheFs,name,EFileRead|EFileWrite);
   207 			test(err == KErrNone || err == KErrAlreadyExists);
   211 			test_Value(err, err == KErrNone || err == KErrAlreadyExists);
   208 			file.Close();
   212 			file.Close();
   209 
   213 
   210 			// ...and another to compare against
   214 			// ...and another to compare against
   211 			name = sourceCompare;
   215 			name = sourceCompare;
   212 			name.Append(_L("File"));
   216 			name.Append(_L("File"));
   213 			name.AppendNum(i);
   217 			name.AppendNum(i);
   214 			name.Append(_L(".TXT"));
   218 			name.Append(_L(".TXT"));
   215 
   219 
   216 			err = file.Create(TheFs,name,EFileRead|EFileWrite);
   220 			err = file.Create(TheFs,name,EFileRead|EFileWrite);
   217 			test(err == KErrNone || err == KErrAlreadyExists);
   221 			test_Value(err, err == KErrNone || err == KErrAlreadyExists);
   218 			file.Close();
   222 			file.Close();
   219 			}
   223 			}
   220 		}
   224 		}
   221 	}
   225 	}
   222 
   226 
   231 	if(err == KErrNone)
   235 	if(err == KErrNone)
   232 		{
   236 		{
   233 		buf.Insert(0, _L("\\"));
   237 		buf.Insert(0, _L("\\"));
   234 		buf.Append(_L("\\file"));
   238 		buf.Append(_L("\\file"));
   235 		err = TheFs.Delete(buf);
   239 		err = TheFs.Delete(buf);
   236 		test(err == KErrNone);
   240 		test_KErrNone(err);
   237   		ret = ETrue;
   241   		ret = ETrue;
   238 		}
   242 		}
   239 	RmDir(_L("\\longname1\\"));
   243 	RmDir(_L("\\longname1\\"));
   240 	return ret;
   244 	return ret;
   241 	}
   245 	}
   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 		{
   335 		if (testingInvalidPathLengths)
   339 		if (testingInvalidPathLengths)
   336 			{
   340 			{
   337 			TFileName name1(KLongName1);
   341 			TFileName name1(KLongName1);
   338 			name1+=_L("\\NAME\\ABCDE\\*.*");
   342 			name1+=_L("\\NAME\\ABCDE\\*.*");
   339 			r=gFileMan->Delete(name1);	
   343 			r=gFileMan->Delete(name1);	
   340 			test(r==KErrNone);
   344 			test_KErrNone(r);
   341 
   345 
   342 			r=gFileMan->Delete(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\NAME\\FGHIJ\\*.*"));	
   346 			r=gFileMan->Delete(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\NAME\\FGHIJ\\*.*"));	
   343 			test(r==KErrNone);
   347 			test_KErrNone(r);
   344 			}
   348 			}
   345 		}
   349 		}
   346 	else
   350 	else
   347 		{
   351 		{
   348 		gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),0,gStat);
   352 		gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),0,gStat);
   351 			{
   355 			{
   352 			TFileName name1(KLongName1);
   356 			TFileName name1(KLongName1);
   353 			name1+=_L("\\NAME\\ABCDE\\*.*");
   357 			name1+=_L("\\NAME\\ABCDE\\*.*");
   354 			r=gFileMan->Delete(name1,0,gStat);	
   358 			r=gFileMan->Delete(name1,0,gStat);	
   355 			WaitForSuccess();
   359 			WaitForSuccess();
   356 			test(r==KErrNone);
   360 			test_KErrNone(r);
   357 		
   361 		
   358 			r=gFileMan->Delete(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\NAME\\FGHIJ\\*.*"),0,gStat);	
   362 			r=gFileMan->Delete(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\NAME\\FGHIJ\\*.*"),0,gStat);	
   359 			WaitForSuccess();
   363 			WaitForSuccess();
   360 			test(r==KErrNone);
   364 			test_KErrNone(r);
   361 			}
   365 			}
   362 		}
   366 		}
   363 
   367 
   364 	test.Next(_L("Check files are deleted"));
   368 	test.Next(_L("Check files are deleted"));
   365 	RmDir(_L("\\F32-TST\\TFMAN\\After\\"));
   369 	RmDir(_L("\\F32-TST\\TFMAN\\After\\"));
   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 //
   439 		MakeFile(_L("\\START\\LONG\\ABCDEFGH01ABCDEFGH01ABCDEFGH01ABCDEFGH01.txt"));
   443 		MakeFile(_L("\\START\\LONG\\ABCDEFGH01ABCDEFGH01ABCDEFGH01ABCDEFGH01.txt"));
   440 		MakeFile(_L("\\START\\LONG\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt"));
   444 		MakeFile(_L("\\START\\LONG\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt"));
   441 		MakeFile(_L("\\START\\LONG\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt"));
   445 		MakeFile(_L("\\START\\LONG\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt"));
   442 		MakeFile(_L("\\START\\LONG\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.txt"));
   446 		MakeFile(_L("\\START\\LONG\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.txt"));
   443 		r=gFileMan->Rename(_L("\\START\\LONG"),_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
   447 		r=gFileMan->Rename(_L("\\START\\LONG"),_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
   444 		test(r==KErrNone);
   448 		test_KErrNone(r);
   445 		MakeDir(_L("\\START\\ASDFFDSA\\"));
   449 		MakeDir(_L("\\START\\ASDFFDSA\\"));
   446 		}
   450 		}
   447 
   451 
   448 	//testing invalid source path at the beginning:
   452 	//testing invalid source path at the beginning:
   449 	if (!gAsynch)
   453 	if (!gAsynch)
   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\\"));
   591 		r=gFileMan->Copy(fn,_L("\\F32-TST\\TFMAN\\COPYDIR\\"),0,gStat);
   595 		r=gFileMan->Copy(fn,_L("\\F32-TST\\TFMAN\\COPYDIR\\"),0,gStat);
   592 	TestResult(KErrNone);
   596 	TestResult(KErrNone);
   593 
   597 
   594 	TEntry entry;
   598 	TEntry entry;
   595 	r=TheFs.Entry(_L("\\F32-TST\\TFMAN\\COPYDIR\\T_FSRV.CPP"),entry);
   599 	r=TheFs.Entry(_L("\\F32-TST\\TFMAN\\COPYDIR\\T_FSRV.CPP"),entry);
   596 	test(r==KErrNone);
   600 	test_KErrNone(r);
   597 	test(entry.iName.MatchF(_L("T_FSRV.CPP"))!=KErrNotFound);
   601 	test(entry.iName.MatchF(_L("T_FSRV.CPP"))!=KErrNotFound);
   598 #if defined (__WINS__)
   602 #if defined (__WINS__)
   599 	test(entry.iAtt==KEntryAttArchive);
   603 	test_Equal(KEntryAttArchive, entry.iAtt);
   600 #else
   604 #else
   601 	if (!IsTestingLFFS())
   605 	if (!IsTestingLFFS())
   602 		test(entry.iAtt==KEntryAttReadOnly);
   606 		{
   603 	else
   607 	    test_Equal(KEntryAttReadOnly, entry.iAtt);
       
   608 		}
       
   609 	else
       
   610 		{
   604 		test(entry.iAtt&KEntryAttReadOnly); // ???
   611 		test(entry.iAtt&KEntryAttReadOnly); // ???
       
   612 		}
   605 #endif
   613 #endif
   606 	r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\COPYDIR\\T_FSRV.CPP"),0,KEntryAttReadOnly);
   614 	r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\COPYDIR\\T_FSRV.CPP"),0,KEntryAttReadOnly);
   607 	test(r==KErrNone);
   615 	test_KErrNone(r);
   608 
   616 
   609 	r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA?.TXT"));
   617 	r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA?.TXT"));
   610 	test(r==KErrNone);
   618 	test_KErrNone(r);
   611 	r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA?.TXT"));
   619 	r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA?.TXT"));
   612 	test(r==KErrNone);
   620 	test_KErrNone(r);
   613 	}
   621 	}
   614 
   622 
   615 LOCAL_C void TestDEF121663_Setup(TFileName& aSrcPath)
   623 LOCAL_C void TestDEF121663_Setup(TFileName& aSrcPath)
   616 	{
   624 	{
   617 	RmDir(aSrcPath);
   625 	RmDir(aSrcPath);
  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
  1155 		r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\MoveDIR\\FILE1.TXT"),0);
  1163 		r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\MoveDIR\\FILE1.TXT"),0);
  1156 	else
  1164 	else
  1157 		r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\MoveDIR\\FILE1.TXT"),0,gStat);
  1165 		r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\MoveDIR\\FILE1.TXT"),0,gStat);
  1158 	TestResult(r,KErrAlreadyExists);
  1166 	TestResult(r,KErrAlreadyExists);
  1159 	r=TheFs.Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
  1167 	r=TheFs.Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
  1160 	test(r==KErrNone);
  1168 	test_KErrNone(r);
  1161 
  1169 
  1162 	test.Next(_L("Check files have been moved"));
  1170 	test.Next(_L("Check files have been moved"));
  1163 	RmDir(_L("\\F32-TST\\TFMAN\\AFTER\\*"));
  1171 	RmDir(_L("\\F32-TST\\TFMAN\\AFTER\\*"));
  1164 	MakeDir(_L("\\F32-TST\\TFMAN\\AFTER\\DELTEST\\EMPTY\\"));
  1172 	MakeDir(_L("\\F32-TST\\TFMAN\\AFTER\\DELTEST\\EMPTY\\"));
  1165 	MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELTEST\\FILE4.TXT"));
  1173 	MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELTEST\\FILE4.TXT"));
  1174 	Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\MOVEDIR\\*"));
  1182 	Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\MOVEDIR\\*"));
  1175 
  1183 
  1176 	if (testingInvalidPathLengths)
  1184 	if (testingInvalidPathLengths)
  1177 		{
  1185 		{
  1178 		r=gFileMan->RmDir(_L("\\TEST\\"));
  1186 		r=gFileMan->RmDir(_L("\\TEST\\"));
  1179 		test(r==KErrNone);
  1187 		test_KErrNone(r);
  1180 		}
  1188 		}
  1181 	
  1189 	
  1182 	TestDEF121663(); // Test moving directory to its subdirectory
  1190 	TestDEF121663(); // Test moving directory to its subdirectory
  1183 	TestDEF123575(); // Test moving directories where src and trg have matching subdirectory structures
  1191 	TestDEF123575(); // Test moving directories where src and trg have matching subdirectory structures
  1184 	TestDEF125570(); // Test move when trg has at least one of the src dirs
  1192 	TestDEF125570(); // Test move when trg has at least one of the src dirs
  1205 	MakeFile(_L("\\F32-TST\\TFMAN\\FMAN2\\PETER.TXT"));
  1213 	MakeFile(_L("\\F32-TST\\TFMAN\\FMAN2\\PETER.TXT"));
  1206 
  1214 
  1207 	CFileMan* fman=CFileMan::NewL(TheFs);
  1215 	CFileMan* fman=CFileMan::NewL(TheFs);
  1208 	TRequestStatus stat1;
  1216 	TRequestStatus stat1;
  1209 	TInt r=fman->Delete(_L("\\F32-TST\\TFMAN\\FMAN1\\*.*"),0,stat1);
  1217 	TInt r=fman->Delete(_L("\\F32-TST\\TFMAN\\FMAN1\\*.*"),0,stat1);
  1210 	test(r==KErrNone);
  1218 	test_KErrNone(r);
  1211 	r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\FMAN2\\*.TXT"),_L("\\F32-TST\\TFMAN\\FMAN2\\*.EXT"),0,gStat);
  1219 	r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\FMAN2\\*.TXT"),_L("\\F32-TST\\TFMAN\\FMAN2\\*.EXT"),0,gStat);
  1212 	test(r==KErrNone);
  1220 	test_KErrNone(r);
  1213 	FOREVER
  1221 	FOREVER
  1214 		{
  1222 		{
  1215 		if (stat1!=KRequestPending && gStat!=KRequestPending)
  1223 		if (stat1!=KRequestPending && gStat!=KRequestPending)
  1216 			break;
  1224 			break;
  1217 		User::WaitForAnyRequest();
  1225 		User::WaitForAnyRequest();
  1241 	test.Next(_L("Test wildcards are replaced with letters from the matched file (DEF092084)"));
  1249 	test.Next(_L("Test wildcards are replaced with letters from the matched file (DEF092084)"));
  1242 	MakeDir(_L("\\DEF092084"));
  1250 	MakeDir(_L("\\DEF092084"));
  1243 	MakeFile(_L("\\DEF092084\\FILE1.TXT"));
  1251 	MakeFile(_L("\\DEF092084\\FILE1.TXT"));
  1244 	
  1252 	
  1245 	TInt r = gFileMan->Rename(_L("\\DEF092084\\*.TXT"),_L("\\DEF092084\\*.DDB"), CFileMan::EOverWrite);
  1253 	TInt r = gFileMan->Rename(_L("\\DEF092084\\*.TXT"),_L("\\DEF092084\\*.DDB"), CFileMan::EOverWrite);
  1246 	test(r==KErrNone); 
  1254 	test_KErrNone(r); 
  1247 	CheckFileExists(_L("\\DEF092084\\FILE1.DDB"), KErrNone);
  1255 	CheckFileExists(_L("\\DEF092084\\FILE1.DDB"), KErrNone);
  1248 	
  1256 	
  1249 	r = gFileMan->Rename(_L("\\DEF092084\\?*.DD?"),_L("\\DEF092084\\?*.TXT"), CFileMan::EOverWrite);
  1257 	r = gFileMan->Rename(_L("\\DEF092084\\?*.DD?"),_L("\\DEF092084\\?*.TXT"), CFileMan::EOverWrite);
  1250 	test(r==KErrNone); 
  1258 	test_KErrNone(r); 
  1251 	CheckFileExists(_L("\\DEF092084\\FILE1.TXT"), KErrNone);
  1259 	CheckFileExists(_L("\\DEF092084\\FILE1.TXT"), KErrNone);
  1252 	
  1260 	
  1253 	RmDir(_L("\\DEF092084\\"));  
  1261 	RmDir(_L("\\DEF092084\\"));  
  1254 	}
  1262 	}
  1255   
  1263   
  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)"));
  1411 		MakeDir(_L("\\LONGNAME\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\"));
  1419 		MakeDir(_L("\\LONGNAME\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\"));
  1412 		MakeFile(_L("\\LONGNAME\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt"));
  1420 		MakeFile(_L("\\LONGNAME\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt"));
  1413 		MakeFile(_L("\\LONGNAME\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt"));
  1421 		MakeFile(_L("\\LONGNAME\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt"));
  1414 		MakeFile(_L("\\LONGNAME\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.bin"));
  1422 		MakeFile(_L("\\LONGNAME\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.bin"));
  1415 		r=gFileMan->Rename(_L("\\LONGNAME"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
  1423 		r=gFileMan->Rename(_L("\\LONGNAME"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
  1416 		test(r==KErrNone);
  1424 		test_KErrNone(r);
  1417 
  1425 
  1418 	//	Two long directory names - makes paths invalid
  1426 	//	Two long directory names - makes paths invalid
  1419 		MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ"));
  1427 		MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ"));
  1420 		MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\"));
  1428 		MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\"));
  1421 		MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT.txt"));
  1429 		MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT.txt"));
  1422 		MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE.txt"));
  1430 		MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE.txt"));
  1423 		r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite);
  1431 		r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite);
  1424 		test(r==KErrNone);
  1432 		test_KErrNone(r);
  1425 		}
  1433 		}
  1426 
  1434 
  1427 	//testing invalid source path at the beginning:
  1435 	//testing invalid source path at the beginning:
  1428 	if (!gAsynch)
  1436 	if (!gAsynch)
  1429 		{
  1437 		{
  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
  1725 		ret = TheFs.Replace(oldname, longname);
  1733 		ret = TheFs.Replace(oldname, longname);
  1726 		}
  1734 		}
  1727 	if(oldname.Length() >= KMaxFileName-5) // if not, it means that we won't be calling ShrinkNames !!
  1735 	if(oldname.Length() >= KMaxFileName-5) // if not, it means that we won't be calling ShrinkNames !!
  1728 		{
  1736 		{
  1729 		TInt r = gFileMan->Rename(_L("\\12345678\\Book\\12345678"),_L("\\INC091841\\Book\\012-235-abcd"),0);
  1737 		TInt r = gFileMan->Rename(_L("\\12345678\\Book\\12345678"),_L("\\INC091841\\Book\\012-235-abcd"),0);
  1730 		test(r==KErrNone);  
  1738 		test_KErrNone(r);  
  1731 		CDir* dir;
  1739 		CDir* dir;
  1732 		r = TheFs.GetDir(_L("\\INC091841\\Book\\012-235-abcd\\"), KEntryAttNormal, ESortNone, dir);
  1740 		r = TheFs.GetDir(_L("\\INC091841\\Book\\012-235-abcd\\"), KEntryAttNormal, ESortNone, dir);
  1733 		test(r==KErrNone);   
  1741 		test_KErrNone(r);   
  1734 		r = KErrNotFound;
  1742 		r = KErrNotFound;
  1735 		TInt dirlen = sizeof("\\INC091841\\Book\\012-235-abcd\\");
  1743 		TInt dirlen = sizeof("\\INC091841\\Book\\012-235-abcd\\");
  1736 		for(TInt i=0; r==KErrNotFound && i<dir->Count(); i++)
  1744 		for(TInt i=0; r==KErrNotFound && i<dir->Count(); i++)
  1737 			{
  1745 			{
  1738 			if((*dir)[i].iName.Length() + dirlen > oldname.Length())
  1746 			if((*dir)[i].iName.Length() + dirlen > oldname.Length())
  1739 				{
  1747 				{
  1740 				r = KErrNone;
  1748 				r = KErrNone;
  1741 				}
  1749 				}
  1742 			}
  1750 			}
  1743 		delete dir;
  1751 		delete dir;
  1744 		test(r==KErrNone);  
  1752 		test_KErrNone(r);  
  1745 		r = gFileMan->RmDir(_L("\\INC091841\\"));
  1753 		r = gFileMan->RmDir(_L("\\INC091841\\"));
  1746 		test(r==KErrNone);  
  1754 		test_KErrNone(r);  
  1747 		}
  1755 		}
  1748 	RmDir(_L("\\12345678\\"));
  1756 	RmDir(_L("\\12345678\\"));
  1749 	}
  1757 	}
  1750 
  1758 
  1751 LOCAL_C void TestRmDir()
  1759 LOCAL_C void TestRmDir()
  1772 		MakeDir(_L("\\LONGNAMETEST\\"));
  1780 		MakeDir(_L("\\LONGNAMETEST\\"));
  1773 		MakeDir(_L("\\LONGNAMETEST\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\"));
  1781 		MakeDir(_L("\\LONGNAMETEST\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\"));
  1774 		MakeFile(_L("\\LONGNAMETEST\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04"));
  1782 		MakeFile(_L("\\LONGNAMETEST\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04"));
  1775 		MakeFile(_L("\\LONGNAMETEST\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04"));
  1783 		MakeFile(_L("\\LONGNAMETEST\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04"));
  1776 		r=gFileMan->Rename(_L("\\LONGNAMETEST"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
  1784 		r=gFileMan->Rename(_L("\\LONGNAMETEST"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
  1777 		test(r==KErrNone);
  1785 		test_KErrNone(r);
  1778 		}
  1786 		}
  1779 
  1787 
  1780 	//testing invalid source path at the beginning:
  1788 	//testing invalid source path at the beginning:
  1781 	if (!gAsynch)
  1789 	if (!gAsynch)
  1782 		{
  1790 		{
  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
  1903 	MakeDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"));
  1911 	MakeDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"));
  1904 	MakeFile(_L("\\F32-TST\\TFMAN\\OPENFILE\\FILE.TXT"));
  1912 	MakeFile(_L("\\F32-TST\\TFMAN\\OPENFILE\\FILE.TXT"));
  1905 
  1913 
  1906 	RFile file;
  1914 	RFile file;
  1907 	r = file.Open(TheFs,_L("\\F32-TST\\TFMAN\\OPENFILE\\FILE.TXT"), EFileRead | EFileShareExclusive);
  1915 	r = file.Open(TheFs,_L("\\F32-TST\\TFMAN\\OPENFILE\\FILE.TXT"), EFileRead | EFileShareExclusive);
  1908 	test(r==KErrNone);
  1916 	test_KErrNone(r);
  1909 
  1917 
  1910 	if (!gAsynch)
  1918 	if (!gAsynch)
  1911 		{
  1919 		{
  1912 		r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"));
  1920 		r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"));
  1913 		test(r==KErrInUse);
  1921 		test_Equal(KErrInUse, r);
  1914 		
  1922 		
  1915 		file.Close();
  1923 		file.Close();
  1916 		
  1924 		
  1917 		r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"));
  1925 		r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"));
  1918 		test(r==KErrNone);
  1926 		test_KErrNone(r);
  1919 		}
  1927 		}
  1920 	else
  1928 	else
  1921 		{
  1929 		{
  1922 		r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"), gStat);
  1930 		r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"), gStat);
  1923 		test(r==KErrNone);
  1931 		test_KErrNone(r);
  1924 		WaitForResult(KErrInUse);
  1932 		WaitForResult(KErrInUse);
  1925 
  1933 
  1926 		file.Close();
  1934 		file.Close();
  1927 
  1935 
  1928 		r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"), gStat);
  1936 		r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"), gStat);
  1929 		test(r==KErrNone);
  1937 		test_KErrNone(r);
  1930 		WaitForResult(KErrNone);
  1938 		WaitForResult(KErrNone);
  1931 		}
  1939 		}
  1932 
  1940 
  1933 	gFileMan->SetObserver(gObserver);
  1941 	gFileMan->SetObserver(gObserver);
  1934 	}
  1942 	}
  1974 
  1982 
  1975 	// Test behaviour for omitted parameters
  1983 	// Test behaviour for omitted parameters
  1976 	// For this, default should be session path
  1984 	// For this, default should be session path
  1977 	TFileName sessionPath;
  1985 	TFileName sessionPath;
  1978 	r=TheFs.SessionPath(sessionPath);
  1986 	r=TheFs.SessionPath(sessionPath);
  1979 	test(r==KErrNone);
  1987 	test_KErrNone(r);
  1980 
  1988 
  1981 	RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
  1989 	RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
  1982 	MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
  1990 	MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
  1983 	r=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
  1991 	r=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
  1984 
  1992 
  2003 	Compare(_L("\\F32-TST\\TFMAN\\DELDIR\\*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*"));
  2011 	Compare(_L("\\F32-TST\\TFMAN\\DELDIR\\*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*"));
  2004 
  2012 
  2005 	RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
  2013 	RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
  2006 	RmDir(_L("\\F32-TST\\TFMAN\\DELDIR\\"));
  2014 	RmDir(_L("\\F32-TST\\TFMAN\\DELDIR\\"));
  2007 	r=TheFs.SetSessionPath(sessionPath);
  2015 	r=TheFs.SetSessionPath(sessionPath);
  2008 	test(r==KErrNone);
  2016 	test_KErrNone(r);
  2009 	}
  2017 	}
  2010 	
  2018 	
  2011 LOCAL_C void TestRecursiveAttribs()
  2019 LOCAL_C void TestRecursiveAttribs()
  2012 //
  2020 //
  2013 // Test set attribs recursively
  2021 // Test set attribs recursively
  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;
  2117 	MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FILE1.TXT"));
  2137 	MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FILE1.TXT"));
  2118 
  2138 
  2119 	if (!gAsynch)
  2139 	if (!gAsynch)
  2120 		{
  2140 		{
  2121 		TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\RECDELETE\\*.PLP"),CFileMan::ERecurse);
  2141 		TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\RECDELETE\\*.PLP"),CFileMan::ERecurse);
  2122 		test(r==KErrNone);
  2142 		test_KErrNone(r);
  2123 		}
  2143 		}
  2124 	else
  2144 	else
  2125 		{
  2145 		{
  2126 		TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\RECDELETE\\*.PLP"),CFileMan::ERecurse,gStat);
  2146 		TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\RECDELETE\\*.PLP"),CFileMan::ERecurse,gStat);
  2127 		test(r==KErrNone);
  2147 		test_KErrNone(r);
  2128 		WaitForSuccess();
  2148 		WaitForSuccess();
  2129 		}
  2149 		}
  2130 
  2150 
  2131 	RmDir(_L("\\F32-TST\\TFMAN\\after\\"));
  2151 	RmDir(_L("\\F32-TST\\TFMAN\\after\\"));
  2132 	MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FULL\\GRAPE.TXT"));
  2152 	MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FULL\\GRAPE.TXT"));
  2228 		err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), 0);
  2248 		err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), 0);
  2229 	else // Asynchronously	
  2249 	else // Asynchronously	
  2230 		err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), 0, gStat);
  2250 		err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), 0, gStat);
  2231 	test.Next(_L("Test INC108401 : SAME DRIVE with 0"));
  2251 	test.Next(_L("Test INC108401 : SAME DRIVE with 0"));
  2232 	TestResult(err);
  2252 	TestResult(err);
  2233 	// test(err==KErrNone);
  2253 	// test_KErrNone(err);
  2234 	RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\"));
  2254 	RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\"));
  2235 	
  2255 	
  2236 	// case for gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite);
  2256 	// case for gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite);
  2237 	MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\"));
  2257 	MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\"));
  2238 	MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\dest\\"));
  2258 	MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\dest\\"));
  2245 		err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite);
  2265 		err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite);
  2246 	else // Asynchronously	
  2266 	else // Asynchronously	
  2247 		err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite, gStat);
  2267 		err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite, gStat);
  2248 	test.Next(_L("Test INC108401 : SAME DRIVE with CFileMan::EOverWrite"));
  2268 	test.Next(_L("Test INC108401 : SAME DRIVE with CFileMan::EOverWrite"));
  2249 	TestResult(err);
  2269 	TestResult(err);
  2250 	// test(err==KErrNone);
  2270 	// test_KErrNone(err);
  2251 	RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\"));
  2271 	RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\"));
  2252 	
  2272 	
  2253 	// case for gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite|CFileMan::ERecurse);
  2273 	// case for gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite|CFileMan::ERecurse);
  2254 	MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\"));
  2274 	MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\"));
  2255 	MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\dest\\"));
  2275 	MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\dest\\"));
  2266 		err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::ERecurse|CFileMan::EOverWrite);
  2286 		err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::ERecurse|CFileMan::EOverWrite);
  2267 	else // Asynchronously	
  2287 	else // Asynchronously	
  2268 		err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::ERecurse|CFileMan::EOverWrite, gStat);
  2288 		err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::ERecurse|CFileMan::EOverWrite, gStat);
  2269 	test.Next(_L("Test INC108401 : SAME DRIVES with CFileMan::ERecurse|CFileMan::EOverWrite"));
  2289 	test.Next(_L("Test INC108401 : SAME DRIVES with CFileMan::ERecurse|CFileMan::EOverWrite"));
  2270 	TestResult(err);
  2290 	TestResult(err);
  2271 	// test(err==KErrNone);
  2291 	// test_KErrNone(err);
  2272 	RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\"));
  2292 	RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\"));
  2273 	
  2293 	
  2274 	// cleanup for the current drive
  2294 	// cleanup for the current drive
  2275 	RmDir(trgPath);
  2295 	RmDir(trgPath);
  2276 	RmDir(_L("\\F32-TST\\"));
  2296 	RmDir(_L("\\F32-TST\\"));
  2293 	MakeFile(_L("\\INC089638\\source\\subdir1\\file3"));
  2313 	MakeFile(_L("\\INC089638\\source\\subdir1\\file3"));
  2294 	MakeFile(_L("\\INC089638\\source\\subdir1\\file4"));
  2314 	MakeFile(_L("\\INC089638\\source\\subdir1\\file4"));
  2295 	MakeFile(_L("\\INC089638\\source\\subdir2\\file5"));
  2315 	MakeFile(_L("\\INC089638\\source\\subdir2\\file5"));
  2296 	MakeFile(_L("\\INC089638\\source\\subdir2\\file6"));
  2316 	MakeFile(_L("\\INC089638\\source\\subdir2\\file6"));
  2297 	MakeDir(_L("\\INC089638\\dest\\"));
  2317 	MakeDir(_L("\\INC089638\\dest\\"));
  2298 	test(TheFs.SetAtt(_L("\\INC089638\\source\\subdir1"), KEntryAttHidden, 0) == KErrNone);
  2318 	test_KErrNone(TheFs.SetAtt(_L("\\INC089638\\source\\subdir1"), KEntryAttHidden, 0));
  2299 	test(TheFs.SetAtt(_L("\\INC089638\\source\\subdir2"), KEntryAttReadOnly, 0) == KErrNone);
  2319 	test_KErrNone(TheFs.SetAtt(_L("\\INC089638\\source\\subdir2"), KEntryAttReadOnly, 0));
  2300 	
  2320 	
  2301 	TInt r = gFileMan->Move(_L("\\INC089638\\source\\"), _L("\\INC089638\\dest\\"), CFileMan::ERecurse);
  2321 	TInt r = gFileMan->Move(_L("\\INC089638\\source\\"), _L("\\INC089638\\dest\\"), CFileMan::ERecurse);
  2302 	test(r==KErrNone);
  2322 	test_KErrNone(r);
  2303 	r = TheFs.RmDir(_L("\\INC089638\\source\\"));
  2323 	r = TheFs.RmDir(_L("\\INC089638\\source\\"));
  2304 	test(r==KErrNone);
  2324 	test_KErrNone(r);
  2305 	
  2325 	
  2306 	RmDir(_L("\\INC089638\\"));
  2326 	RmDir(_L("\\INC089638\\"));
  2307   }
  2327   }
  2308 
  2328 
  2309 void TestINC101379()
  2329 void TestINC101379()
  2323 	gFileMan->SetObserver(NULL);
  2343 	gFileMan->SetObserver(NULL);
  2324 	if (!gAsynch)
  2344 	if (!gAsynch)
  2325 		err = gFileMan->Move(KSourceDir, dest, CFileMan::ERecurse|CFileMan::EOverWrite);
  2345 		err = gFileMan->Move(KSourceDir, dest, CFileMan::ERecurse|CFileMan::EOverWrite);
  2326 	else
  2346 	else
  2327 		err = gFileMan->Move(KSourceDir, dest, CFileMan::ERecurse|CFileMan::EOverWrite, gStat);
  2347 		err = gFileMan->Move(KSourceDir, dest, CFileMan::ERecurse|CFileMan::EOverWrite, gStat);
  2328 	test(err==KErrInUse); // Recursive move prohibited
  2348 	test_Equal(KErrInUse, err); // Recursive move prohibited
  2329 	if (gAsynch)
  2349 	if (gAsynch)
  2330 		WaitForResult(KErrInUse);
  2350 		WaitForResult(KErrInUse);
  2331 	CheckFileContents(KFile1, _L8("qwerty"));
  2351 	CheckFileContents(KFile1, _L8("qwerty"));
  2332 	CheckFileContents(KFile2, _L8("abc"));
  2352 	CheckFileContents(KFile2, _L8("abc"));
  2333 	CheckFileContents(KFile3, _L8("qwerty"));
  2353 	CheckFileContents(KFile3, _L8("qwerty"));
  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
  2811 
  2831 
  2812 	TFileName destOtherDrive;
  2832 	TFileName destOtherDrive;
  2813 	SetupDirectories(EFalse, &destOtherDrive);
  2833 	SetupDirectories(EFalse, &destOtherDrive);
  2814 
  2834 
  2815 	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse);
  2835 	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse);
  2816 	test(err == KErrNotFound);	// Expected - directory is empty
  2836 	test_Equal(KErrNotFound, err);	// Expected - directory is empty
  2817 
  2837 
  2818 	// Test that all directories are still present
  2838 	// Test that all directories are still present
  2819 	TEntry entry;
  2839 	TEntry entry;
  2820 	err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry);
  2840 	err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry);
  2821 	test(err == KErrNone);
  2841 	test_KErrNone(err);
  2822 	err = TheFs.Entry(destOtherDrive, entry);
  2842 	err = TheFs.Entry(destOtherDrive, entry);
  2823 	test(err == KErrNone);
  2843 	test_KErrNone(err);
  2824 
  2844 
  2825 	//--------------------------------------------- 
  2845 	//--------------------------------------------- 
  2826 	//! @SYMTestCaseID			PBASE-T_FMAN-0571
  2846 	//! @SYMTestCaseID			PBASE-T_FMAN-0571
  2827 	//! @SYMTestType			UT
  2847 	//! @SYMTestType			UT
  2828 	//! @SYMREQ					INC108401
  2848 	//! @SYMREQ					INC108401
  2861 	//
  2881 	//
  2862 	test.Next(_L("Test moving a directory containing subdirectories"));
  2882 	test.Next(_L("Test moving a directory containing subdirectories"));
  2863 
  2883 
  2864 	SetupDirectories(ETrue, &destOtherDrive);
  2884 	SetupDirectories(ETrue, &destOtherDrive);
  2865 	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse | CFileMan::EOverWrite);
  2885 	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse | CFileMan::EOverWrite);
  2866 	test(err == KErrNone);
  2886 	test_KErrNone(err);
  2867 
  2887 
  2868 	destOtherDrive.Append(_L("*"));
  2888 	destOtherDrive.Append(_L("*"));
  2869 	Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
  2889 	Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
  2870 
  2890 
  2871 	//--------------------------------------------- 
  2891 	//--------------------------------------------- 
  2883 	SetupDirectories(ETrue, &destOtherDrive);
  2903 	SetupDirectories(ETrue, &destOtherDrive);
  2884 	
  2904 	
  2885 	RmDir(destOtherDrive);
  2905 	RmDir(destOtherDrive);
  2886 
  2906 
  2887 	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse);
  2907 	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse);
  2888 	test(err == KErrNone);
  2908 	test_KErrNone(err);
  2889 
  2909 
  2890 	Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
  2910 	Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
  2891 
  2911 
  2892 	SetupDirectories(ETrue, &destOtherDrive);
  2912 	SetupDirectories(ETrue, &destOtherDrive);
  2893 	
  2913 	
  2894 	RmDir(destOtherDrive);
  2914 	RmDir(destOtherDrive);
  2895 
  2915 
  2896 	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), destOtherDrive, CFileMan::ERecurse);
  2916 	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), destOtherDrive, CFileMan::ERecurse);
  2897 	test(err == KErrNone);
  2917 	test_KErrNone(err);
  2898 
  2918 
  2899 	MakeDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
  2919 	MakeDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
  2900 	destOtherDrive.Append(_L("source\\"));
  2920 	destOtherDrive.Append(_L("source\\"));
  2901 	Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
  2921 	Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
  2902 	RmDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
  2922 	RmDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
  2904 	SetupDirectories(ETrue, &destOtherDrive);
  2924 	SetupDirectories(ETrue, &destOtherDrive);
  2905 
  2925 
  2906 	RmDir(destOtherDrive);
  2926 	RmDir(destOtherDrive);
  2907 
  2927 
  2908 	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), destOtherDrive, CFileMan::ERecurse);
  2928 	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), destOtherDrive, CFileMan::ERecurse);
  2909 	test(err == KErrNone);
  2929 	test_KErrNone(err);
  2910 
  2930 
  2911 	CheckFileExists(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), KErrNotFound, ETrue);
  2931 	CheckFileExists(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), KErrNotFound, ETrue);
  2912 	destOtherDrive.Append(_L("File1.TXT"));
  2932 	destOtherDrive.Append(_L("File1.TXT"));
  2913 	CheckFileExists(destOtherDrive, KErrNone, ETrue);
  2933 	CheckFileExists(destOtherDrive, KErrNone, ETrue);
  2914 
  2934 
  2924 	// Set up the test directory
  2944 	// Set up the test directory
  2925 	TInt level = 0;
  2945 	TInt level = 0;
  2926 	for(level=0; level < KNumFiles; level++)
  2946 	for(level=0; level < KNumFiles; level++)
  2927 		{
  2947 		{
  2928 		err = TheFs.MkDirAll(complexFile[level]);
  2948 		err = TheFs.MkDirAll(complexFile[level]);
  2929 		test(err == KErrNone || err == KErrAlreadyExists);
  2949 		test_Value(err, err == KErrNone || err == KErrAlreadyExists);
  2930 
  2950 
  2931 		RFile file;
  2951 		RFile file;
  2932 		err = file.Create(TheFs, complexFile[level], EFileRead | EFileWrite);
  2952 		err = file.Create(TheFs, complexFile[level], EFileRead | EFileWrite);
  2933 		test(err == KErrNone || err == KErrAlreadyExists || err == KErrBadName);
  2953 		test_Value(err, err == KErrNone || err == KErrAlreadyExists || err == KErrBadName);
  2934 		file.Close();
  2954 		file.Close();
  2935 		}
  2955 		}
  2936 
  2956 
  2937 	//
  2957 	//
  2938 	// Move directory 'dir1' into 'dir12' *without* overwrite flag set
  2958 	// Move directory 'dir1' into 'dir12' *without* overwrite flag set
  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 	
  3105 //
  3125 //
  3106 	{
  3126 	{
  3107 	TInt lastError=iFileMan->GetLastError();
  3127 	TInt lastError=iFileMan->GetLastError();
  3108 	if (lastError!=KErrNone)
  3128 	if (lastError!=KErrNone)
  3109 		{
  3129 		{
  3110 		test(lastError==KErrAlreadyExists);
  3130 		test_Equal(KErrAlreadyExists, lastError);
  3111 		if (gAsynch==EFalse)
  3131 		if (gAsynch==EFalse)
  3112 			{
  3132 			{
  3113 			TFileName fileName=iFileMan->CurrentEntry().iName;
  3133 			TFileName fileName=iFileMan->CurrentEntry().iName;
  3114 			test.Printf(_L("     %S already exists\n"),&fileName);
  3134 			test.Printf(_L("     %S already exists\n"),&fileName);
  3115 			}
  3135 			}
  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 	}
  3228 	{
  3248 	{
  3229 	test.Next(_L("Test error handling"));
  3249 	test.Next(_L("Test error handling"));
  3230 	if (!gAsynch)
  3250 	if (!gAsynch)
  3231 		{
  3251 		{
  3232 		TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\BADPATH\\*"));
  3252 		TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\BADPATH\\*"));
  3233 		test(r==KErrPathNotFound);
  3253 		test_Equal(KErrPathNotFound, r);
  3234 		}
  3254 		}
  3235 	else
  3255 	else
  3236 		{
  3256 		{
  3237 		TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\BADPATH\\*"),0,gStat);
  3257 		TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\BADPATH\\*"),0,gStat);
  3238 		test(r==KErrNone);
  3258 		test_KErrNone(r);
  3239 		WaitForResult(KErrPathNotFound);
  3259 		WaitForResult(KErrPathNotFound);
  3240 		}
  3260 		}
  3241 
  3261 
  3242 	CFileMan* fMan=CFileMan::NewL(TheFs);
  3262 	CFileMan* fMan=CFileMan::NewL(TheFs);
  3243 	TInt r;
  3263 	TInt r;
  3250 			// found a non-extant drive, test it...
  3270 			// found a non-extant drive, test it...
  3251 			_LIT(KBad,"?:\\BADPATH\\*");
  3271 			_LIT(KBad,"?:\\BADPATH\\*");
  3252 			TBuf<16> bad(KBad);
  3272 			TBuf<16> bad(KBad);
  3253 			bad[0] = TUint16('A'+drvNum);
  3273 			bad[0] = TUint16('A'+drvNum);
  3254 			TInt r=fMan->Delete(bad);
  3274 			TInt r=fMan->Delete(bad);
  3255 			test(r==KErrNotReady);
  3275 			test_Equal(KErrNotReady, r);
  3256 			break;
  3276 			break;
  3257 			}
  3277 			}
  3258 		}
  3278 		}
  3259 	}
  3279 	}
  3260 	delete fMan;
  3280 	delete fMan;
  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
  3425 	MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abcdefghijk.def"));
  3445 	MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abcdefghijk.def"));
  3426 	MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abc.defgh"));
  3446 	MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abc.defgh"));
  3427 	MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abcdefghijk.defgh"));
  3447 	MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abcdefghijk.defgh"));
  3428 
  3448 
  3429 	TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*.*"));
  3449 	TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*.*"));
  3430 	test(r==KErrNone);
  3450 	test_KErrNone(r);
  3431 	Compare(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\*"),_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*"));
  3451 	Compare(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\*"),_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*"));
  3432 	r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*.*"));
  3452 	r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*.*"));
  3433 	test(r==KErrNone);
  3453 	test_KErrNone(r);
  3434 	}
  3454 	}
  3435 
  3455 
  3436 LOCAL_C void TestLongNames()
  3456 LOCAL_C void TestLongNames()
  3437 //
  3457 //
  3438 // Synchronous test of name mangling
  3458 // 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 //
  3531 	MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\readonlyhidden.def"),KEntryAttReadOnly|KEntryAttHidden);
  3551 	MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\readonlyhidden.def"),KEntryAttReadOnly|KEntryAttHidden);
  3532 	MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\hiddensystem.def"),KEntryAttHidden|KEntryAttSystem);
  3552 	MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\hiddensystem.def"),KEntryAttHidden|KEntryAttSystem);
  3533 	MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\systemarchive.def"),KEntryAttArchive|KEntryAttSystem);
  3553 	MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\systemarchive.def"),KEntryAttArchive|KEntryAttSystem);
  3534 
  3554 
  3535 	TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*.*"));
  3555 	TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*.*"));
  3536 	test(r==KErrNone);
  3556 	test_KErrNone(r);
  3537 	Compare(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*"));
  3557 	Compare(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*"));
  3538 	r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*"),0,KEntryAttReadOnly,TTime(0));
  3558 	r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*"),0,KEntryAttReadOnly,TTime(0));
  3539 	test(r==KErrNone);
  3559 	test_KErrNone(r);
  3540 	r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*"),0,KEntryAttReadOnly,TTime(0));
  3560 	r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*"),0,KEntryAttReadOnly,TTime(0));
  3541 	test(r==KErrNone);
  3561 	test_KErrNone(r);
  3542 	r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\FILEATT\\"));
  3562 	r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\FILEATT\\"));
  3543 	test(r==KErrNone);
  3563 	test_KErrNone(r);
  3544 	}	
  3564 	}	
  3545 
  3565 
  3546 class CFileManObserverContinue : public CBase, public MFileManObserver
  3566 class CFileManObserverContinue : public CBase, public MFileManObserver
  3547 	{
  3567 	{
  3548 public:
  3568 public:
  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 //
  3737 	CheckFileExists(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),KErrPathNotFound);
  3757 	CheckFileExists(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),KErrPathNotFound);
  3738 	// Check Sketch exists on target drive
  3758 	// Check Sketch exists on target drive
  3739 	CheckFileExists(trgDirFile,KErrNone);
  3759 	CheckFileExists(trgDirFile,KErrNone);
  3740 
  3760 
  3741 	RmDir(trgDir);
  3761 	RmDir(trgDir);
  3742 	test(TheFs.Delete(trgFile) == KErrNone);	
  3762 	test_KErrNone(TheFs.Delete(trgFile));	
  3743 
  3763 
  3744 	TestINC101844(); // Test move files and subdirs with different attributes
  3764 	TestINC101844(); // Test move files and subdirs with different attributes
  3745 	}
  3765 	}
  3746 
  3766 
  3747 class CFileManObserverCopyAbort : public CBase, public MFileManObserver
  3767 class CFileManObserverCopyAbort : public CBase, public MFileManObserver
  3780 //
  3800 //
  3781 // Observer for testoverwrite tests
  3801 // Observer for testoverwrite tests
  3782 //
  3802 //
  3783 	{
  3803 	{
  3784 	TInt lastError = iFileMan->GetLastError();
  3804 	TInt lastError = iFileMan->GetLastError();
  3785 	test(lastError == KErrNone);
  3805 	test_KErrNone(lastError);
  3786 
  3806 
  3787 	TFileName srcfile;
  3807 	TFileName srcfile;
  3788 	iFileMan->GetCurrentSource(srcfile);
  3808 	iFileMan->GetCurrentSource(srcfile);
  3789 	
  3809 	
  3790 	TInt action = iFileMan->CurrentAction();
  3810 	TInt action = iFileMan->CurrentAction();
  3791 	test(action == CFileMan::EMove   ||
  3811 	test_Value(action,  action == CFileMan::EMove   ||
  3792 		 action == CFileMan::EDelete ||
  3812                         action == CFileMan::EDelete ||
  3793 		 action == CFileMan::ERmDir);
  3813                         action == CFileMan::ERmDir);
  3794 		
  3814 		
  3795 	iCurrentStep--;
  3815 	iCurrentStep--;
  3796 	return(iCurrentStep ? MFileManObserver::EContinue : MFileManObserver::EAbort);
  3816 	return(iCurrentStep ? MFileManObserver::EContinue : MFileManObserver::EAbort);
  3797 	}
  3817 	}
  3798 
  3818 
  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()
  4156 	TestResult(err);
  4176 	TestResult(err);
  4157 
  4177 
  4158 	// Verify src contents after move operation
  4178 	// Verify src contents after move operation
  4159 	CDir *dir = NULL;
  4179 	CDir *dir = NULL;
  4160 	err = TheFs.GetDir(srcPath, KEntryAttMaskSupported, ESortNone, dir);
  4180 	err = TheFs.GetDir(srcPath, KEntryAttMaskSupported, ESortNone, dir);
  4161 	test(6 == dir->Count());
  4181 	test_Equal(6, dir->Count());
  4162 	delete dir;
  4182 	delete dir;
  4163 	// Verify dest contents after move operation
  4183 	// Verify dest contents after move operation
  4164 	err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir);
  4184 	err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir);
  4165 	test(3 == dir->Count());
  4185 	test_Equal(3, dir->Count());
  4166 	delete dir;
  4186 	delete dir;
  4167 	
  4187 	
  4168 	// Recursive move with "\\" at the end of srcPath
  4188 	// Recursive move with "\\" at the end of srcPath
  4169 	// clean up before execution	
  4189 	// clean up before execution	
  4170 	RmDir(srcPath);
  4190 	RmDir(srcPath);
  4177 		err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse, gStat);
  4197 		err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse, gStat);
  4178 	TestResult(err);
  4198 	TestResult(err);
  4179 	
  4199 	
  4180 	// Verify src has no content
  4200 	// Verify src has no content
  4181 	err = TheFs.GetDir(srcPath, KEntryAttMaskSupported, ESortNone, dir);
  4201 	err = TheFs.GetDir(srcPath, KEntryAttMaskSupported, ESortNone, dir);
  4182 	test(0 == dir->Count());
  4202 	test_Equal(0, dir->Count());
  4183 	delete dir;
  4203 	delete dir;
  4184 	// Verify dest contents after move operation
  4204 	// Verify dest contents after move operation
  4185 	err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir);
  4205 	err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir);
  4186 	test(9 == dir->Count());
  4206 	test_Equal(9, dir->Count());
  4187 	delete dir;
  4207 	delete dir;
  4188 	
  4208 	
  4189 	// Recursive move without "\\" at the end of srcPath
  4209 	// Recursive move without "\\" at the end of srcPath
  4190 	// clean up before execution
  4210 	// clean up before execution
  4191 	RmDir(srcPath);
  4211 	RmDir(srcPath);
  4202 		
  4222 		
  4203 	// Add the "\\" at the end of srcPath for verification
  4223 	// Add the "\\" at the end of srcPath for verification
  4204 	srcPath.Append(KPathDelimiter);
  4224 	srcPath.Append(KPathDelimiter);
  4205 	// Verify src doesnt not exist
  4225 	// Verify src doesnt not exist
  4206 	err = gFileMan->RmDir(srcPath);
  4226 	err = gFileMan->RmDir(srcPath);
  4207 	test(err==KErrPathNotFound); // KErrPathNotFound expected as src has been moved to dest
  4227 	test_Equal(KErrPathNotFound, err); // KErrPathNotFound expected as src has been moved to dest
  4208 	// Verify dest after move operation
  4228 	// Verify dest after move operation
  4209 	err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir);
  4229 	err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir);
  4210 	test(1 == dir->Count());
  4230 	test_Equal(1, dir->Count());
  4211 	delete dir;
  4231 	delete dir;
  4212 		
  4232 		
  4213 	// clean up before leaving
  4233 	// clean up before leaving
  4214 	RmDir(srcPath);
  4234 	RmDir(srcPath);
  4215 	RmDir(trgPath);
  4235 	RmDir(trgPath);
  4308 	gAsynch=ETrue;
  4328 	gAsynch=ETrue;
  4309 	test.Next(_L("Asynchronous tests ..."));
  4329 	test.Next(_L("Asynchronous tests ..."));
  4310 	TheFs.SetAllocFailure(gAllocFailOff);
  4330 	TheFs.SetAllocFailure(gAllocFailOff);
  4311 
  4331 
  4312 	TInt uid;
  4332 	TInt uid;
  4313 	test(HAL::Get(HAL::EMachineUid,uid)==KErrNone);
  4333 	test_KErrNone(HAL::Get(HAL::EMachineUid,uid));
  4314 	TBool doTargetTests =  (!IsTestingLFFS() && 
  4334 	TBool doTargetTests =  (!IsTestingLFFS() && 
  4315 							uid!=HAL::EMachineUid_Cogent && 
  4335 							uid!=HAL::EMachineUid_Cogent && 
  4316 							uid!=HAL::EMachineUid_IQ80310 && 
  4336 							uid!=HAL::EMachineUid_IQ80310 && 
  4317 							uid!=HAL::EMachineUid_X86PC);
  4337 							uid!=HAL::EMachineUid_X86PC);
  4318 
  4338 
  4382 	
  4402 	
  4383 	TestDEF130678(); // Test CFileMan::Move does not leak any memory
  4403 	TestDEF130678(); // Test CFileMan::Move does not leak any memory
  4384 #ifndef __WINS__
  4404 #ifndef __WINS__
  4385 	RThread t;
  4405 	RThread t;
  4386 	TThreadStackInfo stack;
  4406 	TThreadStackInfo stack;
  4387 	test(t.StackInfo(stack)==KErrNone);
  4407 	test_KErrNone(t.StackInfo(stack));
  4388 	TestStackUsage(0, stack);
  4408 	TestStackUsage(0, stack);
  4389 #endif
  4409 #endif
  4390 
  4410 
  4391 	Cleanup();
  4411 	Cleanup();
  4392 	DeleteTestDirectory();
  4412 	DeleteTestDirectory();
  4393 	test(TheFs.RmDir(_L("\\F32-TST\\")) == KErrNone);
  4413 	test_KErrNone(TheFs.RmDir(_L("\\F32-TST\\")));
  4394 	}
  4414 	}
  4395 
  4415