sl@0
|
1 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <f32file.h>
|
sl@0
|
17 |
#include <e32test.h>
|
sl@0
|
18 |
#include <hal.h>
|
sl@0
|
19 |
#include "t_server.h"
|
sl@0
|
20 |
#include "t_chlffs.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
GLDEF_D RTest test(_L("T_FMAN"));
|
sl@0
|
23 |
|
sl@0
|
24 |
LOCAL_D CFileMan* gFileMan=NULL;
|
sl@0
|
25 |
LOCAL_D TBool gAsynch=EFalse;
|
sl@0
|
26 |
LOCAL_D TRequestStatus gStat;
|
sl@0
|
27 |
LOCAL_D TBool testingInvalidPathLengths;
|
sl@0
|
28 |
|
sl@0
|
29 |
class CFileManObserver : public CBase, public MFileManObserver
|
sl@0
|
30 |
{
|
sl@0
|
31 |
public:
|
sl@0
|
32 |
CFileManObserver(CFileMan* aFileMan);
|
sl@0
|
33 |
TControl NotifyFileManEnded();
|
sl@0
|
34 |
private:
|
sl@0
|
35 |
CFileMan* iFileMan;
|
sl@0
|
36 |
};
|
sl@0
|
37 |
|
sl@0
|
38 |
LOCAL_D CFileManObserver* gObserver;
|
sl@0
|
39 |
|
sl@0
|
40 |
CFileManObserver::CFileManObserver(CFileMan* aFileMan)
|
sl@0
|
41 |
//
|
sl@0
|
42 |
// Constructor
|
sl@0
|
43 |
//
|
sl@0
|
44 |
{
|
sl@0
|
45 |
__DECLARE_NAME(_S("CFileManObserver"));
|
sl@0
|
46 |
iFileMan=aFileMan;
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
MFileManObserver::TControl CFileManObserver::NotifyFileManEnded()
|
sl@0
|
50 |
//
|
sl@0
|
51 |
// Called back after each FMan tick
|
sl@0
|
52 |
//
|
sl@0
|
53 |
{
|
sl@0
|
54 |
TInt lastError=iFileMan->GetLastError();
|
sl@0
|
55 |
if (lastError!=KErrNone && lastError!=KErrBadName)
|
sl@0
|
56 |
{
|
sl@0
|
57 |
TFileName fileName=iFileMan->CurrentEntry().iName;
|
sl@0
|
58 |
if (gAsynch==EFalse)
|
sl@0
|
59 |
test.Printf(_L("CurrentEntry is %S\n"),&fileName);
|
sl@0
|
60 |
test(lastError==KErrAlreadyExists);
|
sl@0
|
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);
|
sl@0
|
62 |
}
|
sl@0
|
63 |
return(MFileManObserver::EContinue);
|
sl@0
|
64 |
}
|
sl@0
|
65 |
|
sl@0
|
66 |
LOCAL_C void WaitForSuccess()
|
sl@0
|
67 |
//
|
sl@0
|
68 |
// Wait for gStat to complete with KErrNone
|
sl@0
|
69 |
//
|
sl@0
|
70 |
{
|
sl@0
|
71 |
User::WaitForRequest(gStat);
|
sl@0
|
72 |
test(gStat==KErrNone);
|
sl@0
|
73 |
}
|
sl@0
|
74 |
|
sl@0
|
75 |
LOCAL_C void WaitForResult(TInt aResult)
|
sl@0
|
76 |
//
|
sl@0
|
77 |
// Wait for gStat to complete with aResult
|
sl@0
|
78 |
//
|
sl@0
|
79 |
{
|
sl@0
|
80 |
User::WaitForRequest(gStat);
|
sl@0
|
81 |
test(gStat==aResult);
|
sl@0
|
82 |
}
|
sl@0
|
83 |
|
sl@0
|
84 |
LOCAL_C void TestResult(TInt aReturnVal, TInt aExpectedAsynchReturnStatus=KErrNone, TInt aExpectedSynchReturn=KErrNone)
|
sl@0
|
85 |
//
|
sl@0
|
86 |
// Test the result, wait for an asynchronous call
|
sl@0
|
87 |
//
|
sl@0
|
88 |
{
|
sl@0
|
89 |
if (!gAsynch)
|
sl@0
|
90 |
test(aReturnVal==aExpectedAsynchReturnStatus);
|
sl@0
|
91 |
else
|
sl@0
|
92 |
{
|
sl@0
|
93 |
test(aReturnVal==aExpectedSynchReturn);
|
sl@0
|
94 |
WaitForResult(aExpectedAsynchReturnStatus);
|
sl@0
|
95 |
}
|
sl@0
|
96 |
}
|
sl@0
|
97 |
|
sl@0
|
98 |
LOCAL_C void RmDir(const TDesC& aDirName)
|
sl@0
|
99 |
//
|
sl@0
|
100 |
// Remove a directory
|
sl@0
|
101 |
//
|
sl@0
|
102 |
{
|
sl@0
|
103 |
gFileMan->Attribs(aDirName, 0, KEntryAttReadOnly, 0, CFileMan::ERecurse);
|
sl@0
|
104 |
TInt r=gFileMan->RmDir(aDirName);
|
sl@0
|
105 |
test(r==KErrNone || r==KErrNotFound || r==KErrPathNotFound);
|
sl@0
|
106 |
}
|
sl@0
|
107 |
|
sl@0
|
108 |
LOCAL_C void Compare(const TDesC& aDir1,const TDesC& aDir2)
|
sl@0
|
109 |
//
|
sl@0
|
110 |
// Test that the contents of two directories are identical
|
sl@0
|
111 |
//
|
sl@0
|
112 |
{
|
sl@0
|
113 |
CDirScan* scanDir1=CDirScan::NewL(TheFs);
|
sl@0
|
114 |
scanDir1->SetScanDataL(aDir1,KEntryAttMaskSupported,ESortByName);
|
sl@0
|
115 |
CDirScan* scanDir2=CDirScan::NewL(TheFs);
|
sl@0
|
116 |
scanDir2->SetScanDataL(aDir2,KEntryAttMaskSupported,ESortByName);
|
sl@0
|
117 |
|
sl@0
|
118 |
FOREVER
|
sl@0
|
119 |
{
|
sl@0
|
120 |
CDir* entryList1;
|
sl@0
|
121 |
CDir* entryList2;
|
sl@0
|
122 |
|
sl@0
|
123 |
scanDir1->NextL(entryList1);
|
sl@0
|
124 |
scanDir2->NextL(entryList2);
|
sl@0
|
125 |
|
sl@0
|
126 |
if (entryList1==NULL || entryList2==NULL)
|
sl@0
|
127 |
{
|
sl@0
|
128 |
test(entryList1==NULL && entryList2==NULL);
|
sl@0
|
129 |
break;
|
sl@0
|
130 |
}
|
sl@0
|
131 |
|
sl@0
|
132 |
TFileName abbPath1=scanDir1->AbbreviatedPath();
|
sl@0
|
133 |
TFileName abbPath2=scanDir2->AbbreviatedPath();
|
sl@0
|
134 |
test(abbPath1==abbPath2);
|
sl@0
|
135 |
|
sl@0
|
136 |
TInt count1=entryList1->Count();
|
sl@0
|
137 |
TInt count2=entryList2->Count();
|
sl@0
|
138 |
test(count1==count2);
|
sl@0
|
139 |
|
sl@0
|
140 |
while(count1--)
|
sl@0
|
141 |
{
|
sl@0
|
142 |
TEntry entry1=(*entryList1)[count1];
|
sl@0
|
143 |
TEntry entry2=(*entryList2)[count1];
|
sl@0
|
144 |
test(entry1.iName==entry2.iName);
|
sl@0
|
145 |
test(entry1.iAtt==entry2.iAtt);
|
sl@0
|
146 |
}
|
sl@0
|
147 |
|
sl@0
|
148 |
delete entryList1;
|
sl@0
|
149 |
delete entryList2;
|
sl@0
|
150 |
}
|
sl@0
|
151 |
|
sl@0
|
152 |
delete scanDir1;
|
sl@0
|
153 |
delete scanDir2;
|
sl@0
|
154 |
}
|
sl@0
|
155 |
|
sl@0
|
156 |
LOCAL_C void SetupDirectories(TBool aCreateFiles, TFileName* aDestOtherDrive)
|
sl@0
|
157 |
//
|
sl@0
|
158 |
// Set up a directory structure and files to test copying/moving across drives
|
sl@0
|
159 |
//
|
sl@0
|
160 |
{
|
sl@0
|
161 |
TInt err = KErrNone;
|
sl@0
|
162 |
|
sl@0
|
163 |
TFileName sourceName = _L("\\F32-TST\\TFMAN\\source\\");
|
sl@0
|
164 |
TFileName sourceNameSubDir = _L("\\F32-TST\\TFMAN\\source\\subdir\\");
|
sl@0
|
165 |
TFileName sourceCompare = _L("\\F32-TST\\TFMAN\\compare\\");
|
sl@0
|
166 |
TFileName sourceCompareSubDir = _L("\\F32-TST\\TFMAN\\compare\\subdir\\");
|
sl@0
|
167 |
TFileName destSameDrive = _L("\\F32-TST\\TFMAN\\dest\\"); // Target destination on the same drive
|
sl@0
|
168 |
|
sl@0
|
169 |
if(aDestOtherDrive)
|
sl@0
|
170 |
{
|
sl@0
|
171 |
#if !defined(__WINS__)
|
sl@0
|
172 |
*aDestOtherDrive = gSessionPath[0] == 'C' ? _L("D:\\F32-TST\\TFMAN\\dest\\") : _L("C:\\F32-TST\\TFMAN\\dest\\");
|
sl@0
|
173 |
#else
|
sl@0
|
174 |
*aDestOtherDrive = gSessionPath[0] == 'C' ? _L("Y:\\F32-TST\\TFMAN\\dest\\") : _L("C:\\F32-TST\\TFMAN\\dest\\");
|
sl@0
|
175 |
#endif
|
sl@0
|
176 |
err = TheFs.MkDirAll(*aDestOtherDrive);
|
sl@0
|
177 |
test(err == KErrNone || err == KErrAlreadyExists);
|
sl@0
|
178 |
}
|
sl@0
|
179 |
|
sl@0
|
180 |
err = TheFs.MkDirAll(sourceName);
|
sl@0
|
181 |
test(err == KErrNone || err == KErrAlreadyExists);
|
sl@0
|
182 |
|
sl@0
|
183 |
err = TheFs.MkDirAll(sourceCompare);
|
sl@0
|
184 |
test(err == KErrNone || err == KErrAlreadyExists);
|
sl@0
|
185 |
|
sl@0
|
186 |
err = TheFs.MkDirAll(destSameDrive);
|
sl@0
|
187 |
test(err == KErrNone || err == KErrAlreadyExists);
|
sl@0
|
188 |
|
sl@0
|
189 |
if(aCreateFiles)
|
sl@0
|
190 |
{
|
sl@0
|
191 |
err = TheFs.MkDirAll(sourceNameSubDir);
|
sl@0
|
192 |
test(err == KErrNone || err == KErrAlreadyExists);
|
sl@0
|
193 |
|
sl@0
|
194 |
err = TheFs.MkDirAll(sourceCompareSubDir);
|
sl@0
|
195 |
test(err == KErrNone || err == KErrAlreadyExists);
|
sl@0
|
196 |
|
sl@0
|
197 |
for(TInt i=0; i<5; i++)
|
sl@0
|
198 |
{
|
sl@0
|
199 |
// Create a test file to be copied
|
sl@0
|
200 |
TFileName name = sourceName;
|
sl@0
|
201 |
name.Append(_L("File"));
|
sl@0
|
202 |
name.AppendNum(i);
|
sl@0
|
203 |
name.Append(_L(".TXT"));
|
sl@0
|
204 |
|
sl@0
|
205 |
RFile file;
|
sl@0
|
206 |
err = file.Create(TheFs,name,EFileRead|EFileWrite);
|
sl@0
|
207 |
test(err == KErrNone || err == KErrAlreadyExists);
|
sl@0
|
208 |
file.Close();
|
sl@0
|
209 |
|
sl@0
|
210 |
// ...and another to compare against
|
sl@0
|
211 |
name = sourceCompare;
|
sl@0
|
212 |
name.Append(_L("File"));
|
sl@0
|
213 |
name.AppendNum(i);
|
sl@0
|
214 |
name.Append(_L(".TXT"));
|
sl@0
|
215 |
|
sl@0
|
216 |
err = file.Create(TheFs,name,EFileRead|EFileWrite);
|
sl@0
|
217 |
test(err == KErrNone || err == KErrAlreadyExists);
|
sl@0
|
218 |
file.Close();
|
sl@0
|
219 |
}
|
sl@0
|
220 |
}
|
sl@0
|
221 |
}
|
sl@0
|
222 |
|
sl@0
|
223 |
TBool CheckIfShortPathsAreSupported()
|
sl@0
|
224 |
{
|
sl@0
|
225 |
TBool ret = EFalse;
|
sl@0
|
226 |
TBuf<1+8+3+1+4> buf;
|
sl@0
|
227 |
_LIT(KTestFile, "\\longname1\\file");
|
sl@0
|
228 |
RmDir(_L("\\longname1\\"));
|
sl@0
|
229 |
MakeFile(KTestFile);
|
sl@0
|
230 |
TInt err = TheFs.GetShortName(_L("\\longname1\\"), buf);
|
sl@0
|
231 |
if(err == KErrNone)
|
sl@0
|
232 |
{
|
sl@0
|
233 |
buf.Insert(0, _L("\\"));
|
sl@0
|
234 |
buf.Append(_L("\\file"));
|
sl@0
|
235 |
err = TheFs.Delete(buf);
|
sl@0
|
236 |
test(err == KErrNone);
|
sl@0
|
237 |
ret = ETrue;
|
sl@0
|
238 |
}
|
sl@0
|
239 |
RmDir(_L("\\longname1\\"));
|
sl@0
|
240 |
return ret;
|
sl@0
|
241 |
}
|
sl@0
|
242 |
|
sl@0
|
243 |
LOCAL_C void TestDelete()
|
sl@0
|
244 |
//
|
sl@0
|
245 |
// Test files are deleted
|
sl@0
|
246 |
//
|
sl@0
|
247 |
{
|
sl@0
|
248 |
test.Next(_L("Test delete - Set up files and start deleting"));
|
sl@0
|
249 |
|
sl@0
|
250 |
MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\"));
|
sl@0
|
251 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
|
sl@0
|
252 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT"));
|
sl@0
|
253 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE3.TXT"));
|
sl@0
|
254 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\FILE4.TXT"));
|
sl@0
|
255 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EXE1.BIN"));
|
sl@0
|
256 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\EXE2.BIN"));
|
sl@0
|
257 |
|
sl@0
|
258 |
TInt r;
|
sl@0
|
259 |
// absolute path for code warrior two more than wins (\epoc32\winscw\c vs \epoc32\wins\c)
|
sl@0
|
260 |
#if defined(__WINSCW__)
|
sl@0
|
261 |
_LIT(KLongName1,"\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffd");
|
sl@0
|
262 |
#else
|
sl@0
|
263 |
_LIT(KLongName1,"\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa");
|
sl@0
|
264 |
#endif
|
sl@0
|
265 |
|
sl@0
|
266 |
_LIT(KInvalidLongName,"\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdffdsa23asdffdsa24asdffdsa25asdffdsa");
|
sl@0
|
267 |
_LIT(KInvalidLongPath, "\\F32-TST\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\0495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\middle.gif");
|
sl@0
|
268 |
if (testingInvalidPathLengths)
|
sl@0
|
269 |
// Create a path of greater 256 characters by renaming a directory and check it can be
|
sl@0
|
270 |
// manipulated (tests fix to F32)
|
sl@0
|
271 |
{
|
sl@0
|
272 |
// One long directory name - makes paths invalid
|
sl@0
|
273 |
MakeDir(_L("\\TEST\\LONG\\NAME\\ABCDE"));
|
sl@0
|
274 |
MakeDir(_L("\\TEST\\LONG\\NAME\\ABCDE\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\"));
|
sl@0
|
275 |
MakeFile(_L("\\TEST\\LONG\\NAME\\ABCDE\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04"));
|
sl@0
|
276 |
MakeFile(_L("\\TEST\\LONG\\NAME\\ABCDE\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04"));
|
sl@0
|
277 |
TFileName name1(KLongName1);
|
sl@0
|
278 |
r=gFileMan->Rename(_L("\\TEST\\LONG"),name1,CFileMan::EOverWrite);
|
sl@0
|
279 |
test(r==KErrNone);
|
sl@0
|
280 |
// Two long directory names - makes paths invalid
|
sl@0
|
281 |
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ"));
|
sl@0
|
282 |
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\"));
|
sl@0
|
283 |
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04"));
|
sl@0
|
284 |
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04"));
|
sl@0
|
285 |
|
sl@0
|
286 |
// Testing invalid long file name (i.e. >256)
|
sl@0
|
287 |
r=gFileMan->Rename(_L("\\TEST\\LONG"),KInvalidLongName,CFileMan::EOverWrite);
|
sl@0
|
288 |
test(r==KErrBadName);
|
sl@0
|
289 |
|
sl@0
|
290 |
// Testing invalid long path (i.e. >256)
|
sl@0
|
291 |
r=gFileMan->Rename(_L("\\TEST\\LONG"),KInvalidLongPath,CFileMan::EOverWrite);
|
sl@0
|
292 |
test(r==KErrBadName);
|
sl@0
|
293 |
|
sl@0
|
294 |
r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite);
|
sl@0
|
295 |
test(r==KErrNone);
|
sl@0
|
296 |
}
|
sl@0
|
297 |
|
sl@0
|
298 |
//testing invalid source path at the beginning:
|
sl@0
|
299 |
if (!gAsynch)
|
sl@0
|
300 |
{
|
sl@0
|
301 |
r=gFileMan->Delete(_L(":C\\F32-TST\\TFMAN\\DELDIR\\*.TXT"));
|
sl@0
|
302 |
}
|
sl@0
|
303 |
else
|
sl@0
|
304 |
{
|
sl@0
|
305 |
r=gFileMan->Delete(_L(":C\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),0,gStat);
|
sl@0
|
306 |
}
|
sl@0
|
307 |
TestResult(r,KErrBadName,KErrBadName);
|
sl@0
|
308 |
|
sl@0
|
309 |
//testing invalid source path at the middle:
|
sl@0
|
310 |
if (!gAsynch)
|
sl@0
|
311 |
{
|
sl@0
|
312 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\:DELDIR\\*.TXT"));
|
sl@0
|
313 |
}
|
sl@0
|
314 |
else
|
sl@0
|
315 |
{
|
sl@0
|
316 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\:DELDIR\\*.TXT"),0,gStat);
|
sl@0
|
317 |
}
|
sl@0
|
318 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
319 |
|
sl@0
|
320 |
//testing invalid source path at the end:
|
sl@0
|
321 |
if (!gAsynch)
|
sl@0
|
322 |
{
|
sl@0
|
323 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\:*.TXT"));
|
sl@0
|
324 |
}
|
sl@0
|
325 |
else
|
sl@0
|
326 |
{
|
sl@0
|
327 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\:*.TXT"),0,gStat);
|
sl@0
|
328 |
}
|
sl@0
|
329 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
330 |
|
sl@0
|
331 |
if (!gAsynch)
|
sl@0
|
332 |
{
|
sl@0
|
333 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"));
|
sl@0
|
334 |
TestResult(r);
|
sl@0
|
335 |
if (testingInvalidPathLengths)
|
sl@0
|
336 |
{
|
sl@0
|
337 |
TFileName name1(KLongName1);
|
sl@0
|
338 |
name1+=_L("\\NAME\\ABCDE\\*.*");
|
sl@0
|
339 |
r=gFileMan->Delete(name1);
|
sl@0
|
340 |
test(r==KErrNone);
|
sl@0
|
341 |
|
sl@0
|
342 |
r=gFileMan->Delete(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\NAME\\FGHIJ\\*.*"));
|
sl@0
|
343 |
test(r==KErrNone);
|
sl@0
|
344 |
}
|
sl@0
|
345 |
}
|
sl@0
|
346 |
else
|
sl@0
|
347 |
{
|
sl@0
|
348 |
gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),0,gStat);
|
sl@0
|
349 |
WaitForSuccess();
|
sl@0
|
350 |
if (testingInvalidPathLengths)
|
sl@0
|
351 |
{
|
sl@0
|
352 |
TFileName name1(KLongName1);
|
sl@0
|
353 |
name1+=_L("\\NAME\\ABCDE\\*.*");
|
sl@0
|
354 |
r=gFileMan->Delete(name1,0,gStat);
|
sl@0
|
355 |
WaitForSuccess();
|
sl@0
|
356 |
test(r==KErrNone);
|
sl@0
|
357 |
|
sl@0
|
358 |
r=gFileMan->Delete(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\NAME\\FGHIJ\\*.*"),0,gStat);
|
sl@0
|
359 |
WaitForSuccess();
|
sl@0
|
360 |
test(r==KErrNone);
|
sl@0
|
361 |
}
|
sl@0
|
362 |
}
|
sl@0
|
363 |
|
sl@0
|
364 |
test.Next(_L("Check files are deleted"));
|
sl@0
|
365 |
RmDir(_L("\\F32-TST\\TFMAN\\After\\"));
|
sl@0
|
366 |
MakeDir(_L("\\F32-TST\\TFMAN\\AFTER\\DELDIR\\DELTEST\\EMPTY\\"));
|
sl@0
|
367 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELDIR\\DELTEST\\EXE1.BIN"));
|
sl@0
|
368 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELDIR\\DELTEST\\FILE4.TXT"));
|
sl@0
|
369 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELDIR\\EXE2.BIN"));
|
sl@0
|
370 |
Compare(_L("\\F32-TST\\TFMAN\\DELDIR\\*"),_L("\\F32-TST\\TFMAN\\AFTER\\DELDIR\\*"));
|
sl@0
|
371 |
|
sl@0
|
372 |
if (testingInvalidPathLengths)
|
sl@0
|
373 |
{
|
sl@0
|
374 |
r=gFileMan->RmDir(_L("\\TEST\\"));
|
sl@0
|
375 |
test(r==KErrNone);
|
sl@0
|
376 |
}
|
sl@0
|
377 |
|
sl@0
|
378 |
/**
|
sl@0
|
379 |
Test wild card matching in short file names
|
sl@0
|
380 |
Note this test is only run on FAT file systems as 'short file names' are only
|
sl@0
|
381 |
supported by FAT.
|
sl@0
|
382 |
DEF130113: TTG:<Wild card characters cannot be handled in the short file names>
|
sl@0
|
383 |
*/
|
sl@0
|
384 |
TInt theDrive;
|
sl@0
|
385 |
r=TheFs.CharToDrive(gDriveToTest,theDrive);
|
sl@0
|
386 |
test(r==KErrNone);
|
sl@0
|
387 |
TFSName f;
|
sl@0
|
388 |
r = TheFs.FileSystemName(f, theDrive);
|
sl@0
|
389 |
test(r == KErrNone || r == KErrNotFound);
|
sl@0
|
390 |
if (f.FindF(_L("Fat")) == 0 )
|
sl@0
|
391 |
{
|
sl@0
|
392 |
test.Next(_L("Test wild card matching in short file names"));
|
sl@0
|
393 |
MakeFile(_L("abcdefghi.txt"));
|
sl@0
|
394 |
TInt err = gFileMan->Delete(_L("ABCDEF~*"));
|
sl@0
|
395 |
test(err == KErrNone);
|
sl@0
|
396 |
MakeFile(_L("abcdefghi.txt"));
|
sl@0
|
397 |
err = gFileMan->Delete(_L("ABCDEF~*.TXT"));
|
sl@0
|
398 |
test(err == KErrNone);
|
sl@0
|
399 |
MakeFile(_L("abcdefghi.txt"));
|
sl@0
|
400 |
err = gFileMan->Delete(_L("ABCDEF~*.?XT"));
|
sl@0
|
401 |
test(err == KErrNone);
|
sl@0
|
402 |
MakeFile(_L("abcdefghi.txt"));
|
sl@0
|
403 |
err = gFileMan->Delete(_L("ABCDEF~1.*"));
|
sl@0
|
404 |
test(err == KErrNone);
|
sl@0
|
405 |
}
|
sl@0
|
406 |
}
|
sl@0
|
407 |
|
sl@0
|
408 |
LOCAL_C void TestCopy()
|
sl@0
|
409 |
//
|
sl@0
|
410 |
// Test copy
|
sl@0
|
411 |
//
|
sl@0
|
412 |
{
|
sl@0
|
413 |
test.Next(_L("Test copy"));
|
sl@0
|
414 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\*"));
|
sl@0
|
415 |
|
sl@0
|
416 |
MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
417 |
MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\"));
|
sl@0
|
418 |
MakeFile(_L("\\F32-TST\\TFMAN\\NewDir\\ABC.DEF"));
|
sl@0
|
419 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
|
sl@0
|
420 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT"));
|
sl@0
|
421 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE3.TXT"));
|
sl@0
|
422 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\FILE4.TXT"));
|
sl@0
|
423 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EXE1.BIN"));
|
sl@0
|
424 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\EXE2.BIN"));
|
sl@0
|
425 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA1.TXT"));
|
sl@0
|
426 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA2.TXT"));
|
sl@0
|
427 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA3.TXT"));
|
sl@0
|
428 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA4.TXT"));
|
sl@0
|
429 |
|
sl@0
|
430 |
test.Next(_L("Test copy files to the same directory"));
|
sl@0
|
431 |
TInt r;
|
sl@0
|
432 |
|
sl@0
|
433 |
if (testingInvalidPathLengths)
|
sl@0
|
434 |
// Create a path of greater than 256 characters by renaming a directory and
|
sl@0
|
435 |
// check it can be manipulated (tests fix to F32)
|
sl@0
|
436 |
{
|
sl@0
|
437 |
MakeDir(_L("\\START\\LONG\\"));
|
sl@0
|
438 |
MakeDir(_L("\\FINISH\\"));
|
sl@0
|
439 |
MakeFile(_L("\\START\\LONG\\ABCDEFGH01ABCDEFGH01ABCDEFGH01ABCDEFGH01.txt"));
|
sl@0
|
440 |
MakeFile(_L("\\START\\LONG\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt"));
|
sl@0
|
441 |
MakeFile(_L("\\START\\LONG\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt"));
|
sl@0
|
442 |
MakeFile(_L("\\START\\LONG\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.txt"));
|
sl@0
|
443 |
r=gFileMan->Rename(_L("\\START\\LONG"),_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
|
sl@0
|
444 |
test(r==KErrNone);
|
sl@0
|
445 |
MakeDir(_L("\\START\\ASDFFDSA\\"));
|
sl@0
|
446 |
}
|
sl@0
|
447 |
|
sl@0
|
448 |
//testing invalid source path at the beginning:
|
sl@0
|
449 |
if (!gAsynch)
|
sl@0
|
450 |
{
|
sl@0
|
451 |
r=gFileMan->Copy(_L(":C:\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0);
|
sl@0
|
452 |
}
|
sl@0
|
453 |
else
|
sl@0
|
454 |
{
|
sl@0
|
455 |
r=gFileMan->Copy(_L(":C:\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0,gStat);
|
sl@0
|
456 |
}
|
sl@0
|
457 |
TestResult(r,KErrBadName,KErrBadName);
|
sl@0
|
458 |
|
sl@0
|
459 |
//testing invalid target path at the beginning:
|
sl@0
|
460 |
|
sl@0
|
461 |
if (!gAsynch)
|
sl@0
|
462 |
{
|
sl@0
|
463 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L(":C:\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0);
|
sl@0
|
464 |
}
|
sl@0
|
465 |
else
|
sl@0
|
466 |
{
|
sl@0
|
467 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L(":C:\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0,gStat);
|
sl@0
|
468 |
}
|
sl@0
|
469 |
TestResult(r,KErrBadName,KErrBadName);
|
sl@0
|
470 |
|
sl@0
|
471 |
//testing invalid source path at the middle:
|
sl@0
|
472 |
if (!gAsynch)
|
sl@0
|
473 |
{
|
sl@0
|
474 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\:DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0);
|
sl@0
|
475 |
}
|
sl@0
|
476 |
else
|
sl@0
|
477 |
{
|
sl@0
|
478 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\:DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0,gStat);
|
sl@0
|
479 |
}
|
sl@0
|
480 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
481 |
|
sl@0
|
482 |
//testing invalid target path at the middle:
|
sl@0
|
483 |
if (!gAsynch)
|
sl@0
|
484 |
{
|
sl@0
|
485 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\:DELDIR\\rumba?.txt"),0);
|
sl@0
|
486 |
}
|
sl@0
|
487 |
else
|
sl@0
|
488 |
{
|
sl@0
|
489 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\:DELDIR\\rumba?.txt"),0,gStat);
|
sl@0
|
490 |
}
|
sl@0
|
491 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
492 |
|
sl@0
|
493 |
//testing invalid source path at the end:
|
sl@0
|
494 |
if (!gAsynch)
|
sl@0
|
495 |
{
|
sl@0
|
496 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\:file?.txt"),_L("\\F32-TST\\TFMAN\\:DELDIR\\rumba?.txt"),0);
|
sl@0
|
497 |
}
|
sl@0
|
498 |
else
|
sl@0
|
499 |
{
|
sl@0
|
500 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\:file?.txt"),_L("\\F32-TST\\TFMAN\\:DELDIR\\rumba?.txt"),0,gStat);
|
sl@0
|
501 |
}
|
sl@0
|
502 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
503 |
|
sl@0
|
504 |
//testing invalid target path at the end:
|
sl@0
|
505 |
if (!gAsynch)
|
sl@0
|
506 |
{
|
sl@0
|
507 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\:DELDIR\\:rumba?.txt"),0);
|
sl@0
|
508 |
}
|
sl@0
|
509 |
else
|
sl@0
|
510 |
{
|
sl@0
|
511 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\:DELDIR\\:rumba?.txt"),0,gStat);
|
sl@0
|
512 |
}
|
sl@0
|
513 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
514 |
|
sl@0
|
515 |
if (!gAsynch)
|
sl@0
|
516 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0);
|
sl@0
|
517 |
else
|
sl@0
|
518 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0,gStat);
|
sl@0
|
519 |
TestResult(r,KErrAlreadyExists);
|
sl@0
|
520 |
|
sl@0
|
521 |
if (!gAsynch)
|
sl@0
|
522 |
r = gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\rumba.txt"),0);
|
sl@0
|
523 |
else
|
sl@0
|
524 |
r = gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\rumba.txt"),0,gStat);
|
sl@0
|
525 |
TestResult(r,KErrNone);
|
sl@0
|
526 |
|
sl@0
|
527 |
if (!gAsynch)
|
sl@0
|
528 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\file1.txt"),0);
|
sl@0
|
529 |
else
|
sl@0
|
530 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\file1.txt"),0,gStat);
|
sl@0
|
531 |
TestResult(r,KErrAlreadyExists);
|
sl@0
|
532 |
|
sl@0
|
533 |
if (!gAsynch)
|
sl@0
|
534 |
{
|
sl@0
|
535 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
536 |
test(r==KErrNone);
|
sl@0
|
537 |
if (testingInvalidPathLengths)
|
sl@0
|
538 |
{
|
sl@0
|
539 |
test.Next(_L("Test invalid length paths"));
|
sl@0
|
540 |
r=gFileMan->Copy(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"));
|
sl@0
|
541 |
test(r==KErrNone);
|
sl@0
|
542 |
r=gFileMan->RmDir(_L("\\START\\"));
|
sl@0
|
543 |
test(r==KErrNone);
|
sl@0
|
544 |
r=gFileMan->RmDir(_L("\\FINISH\\"));
|
sl@0
|
545 |
test(r==KErrNone);
|
sl@0
|
546 |
}
|
sl@0
|
547 |
}
|
sl@0
|
548 |
else
|
sl@0
|
549 |
{
|
sl@0
|
550 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\COPYDIR\\"),0,gStat);
|
sl@0
|
551 |
WaitForSuccess();
|
sl@0
|
552 |
test(r==KErrNone);
|
sl@0
|
553 |
if (testingInvalidPathLengths)
|
sl@0
|
554 |
{
|
sl@0
|
555 |
test.Next(_L("Test invalid length paths (Asynch)"));
|
sl@0
|
556 |
r=gFileMan->Copy(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"),0,gStat);
|
sl@0
|
557 |
WaitForSuccess();
|
sl@0
|
558 |
test(r==KErrNone);
|
sl@0
|
559 |
r=gFileMan->RmDir(_L("\\START\\"),gStat);
|
sl@0
|
560 |
WaitForSuccess();
|
sl@0
|
561 |
test(r==KErrNone);
|
sl@0
|
562 |
r=gFileMan->RmDir(_L("\\FINISH\\"),gStat);
|
sl@0
|
563 |
WaitForSuccess();
|
sl@0
|
564 |
test(r==KErrNone);
|
sl@0
|
565 |
}
|
sl@0
|
566 |
}
|
sl@0
|
567 |
|
sl@0
|
568 |
if (!gAsynch)
|
sl@0
|
569 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\NewDir\\*.*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
570 |
else
|
sl@0
|
571 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\NewDir\\*.*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\"),0,gStat);
|
sl@0
|
572 |
TestResult(r);
|
sl@0
|
573 |
|
sl@0
|
574 |
test.Next(_L("Check files have been copied"));
|
sl@0
|
575 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\"));
|
sl@0
|
576 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE1.TXT"));
|
sl@0
|
577 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE2.TXT"));
|
sl@0
|
578 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE3.TXT"));
|
sl@0
|
579 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA1.TXT"));
|
sl@0
|
580 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA2.TXT"));
|
sl@0
|
581 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA3.TXT"));
|
sl@0
|
582 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA4.TXT"));
|
sl@0
|
583 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\ABC.DEF"));
|
sl@0
|
584 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*"));
|
sl@0
|
585 |
|
sl@0
|
586 |
TFileName fn = _L("Z:\\TEST\\T_FSRV.CPP");
|
sl@0
|
587 |
fn[0] = gExeFileName[0];
|
sl@0
|
588 |
if (!gAsynch)
|
sl@0
|
589 |
r=gFileMan->Copy(fn,_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
590 |
else
|
sl@0
|
591 |
r=gFileMan->Copy(fn,_L("\\F32-TST\\TFMAN\\COPYDIR\\"),0,gStat);
|
sl@0
|
592 |
TestResult(KErrNone);
|
sl@0
|
593 |
|
sl@0
|
594 |
TEntry entry;
|
sl@0
|
595 |
r=TheFs.Entry(_L("\\F32-TST\\TFMAN\\COPYDIR\\T_FSRV.CPP"),entry);
|
sl@0
|
596 |
test(r==KErrNone);
|
sl@0
|
597 |
test(entry.iName.MatchF(_L("T_FSRV.CPP"))!=KErrNotFound);
|
sl@0
|
598 |
#if defined (__WINS__)
|
sl@0
|
599 |
test(entry.iAtt==KEntryAttArchive);
|
sl@0
|
600 |
#else
|
sl@0
|
601 |
if (!IsTestingLFFS())
|
sl@0
|
602 |
test(entry.iAtt==KEntryAttReadOnly);
|
sl@0
|
603 |
else
|
sl@0
|
604 |
test(entry.iAtt&KEntryAttReadOnly); // ???
|
sl@0
|
605 |
#endif
|
sl@0
|
606 |
r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\COPYDIR\\T_FSRV.CPP"),0,KEntryAttReadOnly);
|
sl@0
|
607 |
test(r==KErrNone);
|
sl@0
|
608 |
|
sl@0
|
609 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA?.TXT"));
|
sl@0
|
610 |
test(r==KErrNone);
|
sl@0
|
611 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA?.TXT"));
|
sl@0
|
612 |
test(r==KErrNone);
|
sl@0
|
613 |
}
|
sl@0
|
614 |
|
sl@0
|
615 |
LOCAL_C void TestDEF121663_Setup(TFileName& aSrcPath)
|
sl@0
|
616 |
{
|
sl@0
|
617 |
RmDir(aSrcPath);
|
sl@0
|
618 |
MakeDir(aSrcPath);
|
sl@0
|
619 |
|
sl@0
|
620 |
for(TInt index=0; index<10; index++)
|
sl@0
|
621 |
{
|
sl@0
|
622 |
TFileName fileName;
|
sl@0
|
623 |
fileName.Copy(aSrcPath);
|
sl@0
|
624 |
fileName.Append(_L("FILE_"));fileName.AppendNum(index);fileName.Append(_L(".TXT"));
|
sl@0
|
625 |
MakeFile(fileName, _L8("Some Data"));
|
sl@0
|
626 |
}
|
sl@0
|
627 |
}
|
sl@0
|
628 |
|
sl@0
|
629 |
LOCAL_C void TestDEF121663()
|
sl@0
|
630 |
{
|
sl@0
|
631 |
test.Next(_L("Test moving directory to its subdirectory (DEF121663)"));
|
sl@0
|
632 |
|
sl@0
|
633 |
gFileMan->SetObserver(NULL);
|
sl@0
|
634 |
TInt err = 0;
|
sl@0
|
635 |
TFileName srcPath = _L("C:\\TestDEF121663\\");
|
sl@0
|
636 |
|
sl@0
|
637 |
TestDEF121663_Setup(srcPath);
|
sl@0
|
638 |
if(!gAsynch)
|
sl@0
|
639 |
{
|
sl@0
|
640 |
err = gFileMan->Move(_L("C:\\TestDEF121663"),_L("C:\\TestDEF121663\\TestDEF121663"),CFileMan::EOverWrite);
|
sl@0
|
641 |
}
|
sl@0
|
642 |
else
|
sl@0
|
643 |
{
|
sl@0
|
644 |
err = gFileMan->Move(_L("C:\\TestDEF121663"),_L("C:\\TestDEF121663\\TestDEF121663"),CFileMan::EOverWrite, gStat);
|
sl@0
|
645 |
}
|
sl@0
|
646 |
TestResult(err,KErrInUse,KErrInUse);
|
sl@0
|
647 |
|
sl@0
|
648 |
TestDEF121663_Setup(srcPath);
|
sl@0
|
649 |
if(!gAsynch)
|
sl@0
|
650 |
{
|
sl@0
|
651 |
err = gFileMan->Move(_L("C:\\TestDEF121663\\"),_L("C:\\TestDEF121663\\TestDEF121663\\"),CFileMan::EOverWrite);
|
sl@0
|
652 |
}
|
sl@0
|
653 |
else
|
sl@0
|
654 |
{
|
sl@0
|
655 |
err = gFileMan->Move(_L("C:\\TestDEF121663\\"),_L("C:\\TestDEF121663\\TestDEF121663\\"),CFileMan::EOverWrite, gStat);
|
sl@0
|
656 |
}
|
sl@0
|
657 |
TestResult(err,KErrPathNotFound);
|
sl@0
|
658 |
|
sl@0
|
659 |
TestDEF121663_Setup(srcPath);
|
sl@0
|
660 |
if(!gAsynch)
|
sl@0
|
661 |
{
|
sl@0
|
662 |
err = gFileMan->Move(_L("C:\\TestDEF121663\\"),_L("C:\\TestDEF121663\\TestDEF121663"),CFileMan::EOverWrite);
|
sl@0
|
663 |
}
|
sl@0
|
664 |
else
|
sl@0
|
665 |
{
|
sl@0
|
666 |
err = gFileMan->Move(_L("C:\\TestDEF121663\\"),_L("C:\\TestDEF121663\\TestDEF121663"),CFileMan::EOverWrite, gStat);
|
sl@0
|
667 |
}
|
sl@0
|
668 |
TestResult(err,KErrPathNotFound);
|
sl@0
|
669 |
|
sl@0
|
670 |
TestDEF121663_Setup(srcPath);
|
sl@0
|
671 |
if(!gAsynch)
|
sl@0
|
672 |
{
|
sl@0
|
673 |
err = gFileMan->Move(_L("C:\\TestDEF121663"),_L("C:\\TestDEF121663\\TestDEF121663\\"),CFileMan::ERecurse|CFileMan::EOverWrite);
|
sl@0
|
674 |
}
|
sl@0
|
675 |
else
|
sl@0
|
676 |
{
|
sl@0
|
677 |
err = gFileMan->Move(_L("C:\\TestDEF121663"),_L("C:\\TestDEF121663\\TestDEF121663\\"),CFileMan::ERecurse|CFileMan::EOverWrite, gStat);
|
sl@0
|
678 |
}
|
sl@0
|
679 |
TestResult(err,KErrInUse,KErrInUse);
|
sl@0
|
680 |
|
sl@0
|
681 |
TestDEF121663_Setup(srcPath);
|
sl@0
|
682 |
if(!gAsynch)
|
sl@0
|
683 |
{
|
sl@0
|
684 |
err = gFileMan->Move(_L("C:\\TestDEF121663"),_L("C:\\TestDEF121663\\TestDEF121663"),CFileMan::ERecurse);
|
sl@0
|
685 |
}
|
sl@0
|
686 |
else
|
sl@0
|
687 |
{
|
sl@0
|
688 |
err = gFileMan->Move(_L("C:\\TestDEF121663"),_L("C:\\TestDEF121663\\TestDEF121663"),CFileMan::ERecurse, gStat);
|
sl@0
|
689 |
}
|
sl@0
|
690 |
TestResult(err,KErrInUse,KErrInUse);
|
sl@0
|
691 |
|
sl@0
|
692 |
gFileMan->SetObserver(gObserver);
|
sl@0
|
693 |
// remove previous dirs
|
sl@0
|
694 |
RmDir(_L("C:\\TestDEF121663\\"));
|
sl@0
|
695 |
}
|
sl@0
|
696 |
|
sl@0
|
697 |
// Test moving directories where source and target have matching subdirectory structures
|
sl@0
|
698 |
LOCAL_C void TestDEF123575()
|
sl@0
|
699 |
{
|
sl@0
|
700 |
test.Next(_L("Test moving directories with matching subdirectory structures (DEF123575)"));
|
sl@0
|
701 |
TFileName srcPath;
|
sl@0
|
702 |
TFileName destPath;
|
sl@0
|
703 |
TInt err;
|
sl@0
|
704 |
//setup the initial directory structure
|
sl@0
|
705 |
srcPath = _L("\\F32-TST\\DEF123575\\SRCDIR\\CommonDIR\\temp\\temp1.1\\");
|
sl@0
|
706 |
destPath = _L("\\F32-TST\\DEF123575\\DSTDIR\\CommonDIR\\temp\\temp1.1\\");
|
sl@0
|
707 |
MakeDir(srcPath);
|
sl@0
|
708 |
MakeDir(destPath);
|
sl@0
|
709 |
MakeFile(_L("\\F32-TST\\DEF123575\\SRCDIR\\CommonDIR\\temp\\temp1.1\\FILE1.TXT"));
|
sl@0
|
710 |
|
sl@0
|
711 |
srcPath = _L("\\F32-TST\\DEF123575\\SRCDIR\\CommonDIR");
|
sl@0
|
712 |
destPath = _L("\\F32-TST\\DEF123575\\DSTDIR\\");
|
sl@0
|
713 |
if(!gAsynch)
|
sl@0
|
714 |
{
|
sl@0
|
715 |
err = gFileMan->Move(srcPath,destPath,CFileMan::EOverWrite);
|
sl@0
|
716 |
}
|
sl@0
|
717 |
else
|
sl@0
|
718 |
{
|
sl@0
|
719 |
err = gFileMan->Move(srcPath,destPath,CFileMan::EOverWrite, gStat);
|
sl@0
|
720 |
}
|
sl@0
|
721 |
TestResult(err,KErrNone,KErrNone);
|
sl@0
|
722 |
|
sl@0
|
723 |
//test that source directory is empty after move
|
sl@0
|
724 |
MakeDir(_L("\\F32-TST\\DEF123575\\AFTER\\"));
|
sl@0
|
725 |
Compare(_L("\\F32-TST\\DEF123575\\SRCDIR\\*"),_L("\\F32-TST\\DEF123575\\AFTER\\*"));
|
sl@0
|
726 |
//test that the files have been moved to the destination directory
|
sl@0
|
727 |
MakeDir(_L("\\F32-TST\\DEF123575\\AFTER\\CommonDIR\\temp\\temp1.1\\"));
|
sl@0
|
728 |
MakeFile(_L("\\F32-TST\\DEF123575\\AFTER\\CommonDIR\\temp\\temp1.1\\FILE1.TXT"));
|
sl@0
|
729 |
Compare(_L("\\F32-TST\\DEF123575\\DSTDIR\\*"),_L("\\F32-TST\\DEF123575\\AFTER\\*"));
|
sl@0
|
730 |
|
sl@0
|
731 |
//delete the entire directory structure
|
sl@0
|
732 |
RmDir(_L("\\F32-TST\\DEF123575\\*"));
|
sl@0
|
733 |
}
|
sl@0
|
734 |
|
sl@0
|
735 |
LOCAL_C void TestDEF125570()
|
sl@0
|
736 |
{
|
sl@0
|
737 |
test.Next(_L("Test move when trg has at least one of the src dirs (DEF125570)"));
|
sl@0
|
738 |
gFileMan->SetObserver(NULL);
|
sl@0
|
739 |
TInt err = KErrNone;
|
sl@0
|
740 |
TFileName srcPath = _L("C:\\TestDEF125570\\src\\");
|
sl@0
|
741 |
TFileName trgPath = _L("C:\\TestDEF125570\\trg\\");
|
sl@0
|
742 |
|
sl@0
|
743 |
// remove previous dirs
|
sl@0
|
744 |
RmDir(srcPath);
|
sl@0
|
745 |
RmDir(trgPath);
|
sl@0
|
746 |
|
sl@0
|
747 |
//create src
|
sl@0
|
748 |
MakeDir(_L("C:\\TestDEF125570\\src\\DIR1\\"));
|
sl@0
|
749 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR1\\File1.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR1\\File1.txt"));
|
sl@0
|
750 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR1\\File2.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR1\\File2.txt"));
|
sl@0
|
751 |
MakeDir(_L("C:\\TestDEF125570\\src\\DIR1\\DIR11\\"));
|
sl@0
|
752 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR1\\DIR11\\File1.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR1\\DIR11\\File1.txt"));
|
sl@0
|
753 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR1\\DIR11\\File2.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR1\\DIR11\\File2.txt"));
|
sl@0
|
754 |
MakeDir(_L("C:\\TestDEF125570\\src\\DIR2\\"));
|
sl@0
|
755 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR2\\File1.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR2\\File1.txt"));
|
sl@0
|
756 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR2\\File2.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR2\\File2.txt"));
|
sl@0
|
757 |
MakeDir(_L("C:\\TestDEF125570\\src\\DIR2\\DIR12\\"));
|
sl@0
|
758 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR2\\DIR12\\File1.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR2\\DIR12\\File1.txt"));
|
sl@0
|
759 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR2\\DIR12\\File2.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR2\\DIR12\\File2.txt"));
|
sl@0
|
760 |
|
sl@0
|
761 |
//trg has at least one of the src subfolders
|
sl@0
|
762 |
MakeDir(_L("C:\\TestDEF125570\\trg\\DIR2\\"));
|
sl@0
|
763 |
MakeFile(_L("C:\\TestDEF125570\\trg\\DIR2\\File1.txt"),_L8("FILE PATH : C:\\TestDEF125570\\TRG\\DIR2\\File1.txt"));
|
sl@0
|
764 |
MakeFile(_L("C:\\TestDEF125570\\trg\\DIR2\\File2.txt"),_L8("FILE PATH : C:\\TestDEF125570\\TRG\\DIR2\\File2.txt"));
|
sl@0
|
765 |
|
sl@0
|
766 |
if(!gAsynch)
|
sl@0
|
767 |
err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse|CFileMan::EOverWrite);
|
sl@0
|
768 |
else
|
sl@0
|
769 |
err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse|CFileMan::EOverWrite, gStat);
|
sl@0
|
770 |
TestResult(err);
|
sl@0
|
771 |
gFileMan->SetObserver(gObserver);
|
sl@0
|
772 |
// remove previous dirs
|
sl@0
|
773 |
RmDir(_L("C:\\TestDEF125570\\"));
|
sl@0
|
774 |
}
|
sl@0
|
775 |
|
sl@0
|
776 |
LOCAL_C void TestDEF130404()
|
sl@0
|
777 |
{
|
sl@0
|
778 |
test.Printf(_L("Test move when the src doesn't fully exist (DEF130404)"));
|
sl@0
|
779 |
|
sl@0
|
780 |
TInt r = 0;
|
sl@0
|
781 |
TFileName trgPath;
|
sl@0
|
782 |
trgPath.Format(_L("%c:\\TestDEF130404\\Trg\\"), (TUint8)gDriveToTest);
|
sl@0
|
783 |
TFileName srcPath;
|
sl@0
|
784 |
srcPath.Format(_L("C:\\TestDEF130404\\Src\\DIR1\\"), (TUint8)gDriveToTest);
|
sl@0
|
785 |
|
sl@0
|
786 |
// clean up before testing
|
sl@0
|
787 |
RmDir(srcPath);
|
sl@0
|
788 |
RmDir(trgPath);
|
sl@0
|
789 |
|
sl@0
|
790 |
MakeDir(srcPath);
|
sl@0
|
791 |
srcPath.Append(_L("NODIR\\*.*"));
|
sl@0
|
792 |
MakeDir(trgPath);
|
sl@0
|
793 |
|
sl@0
|
794 |
if(!gAsynch)
|
sl@0
|
795 |
r = gFileMan->Move(srcPath, trgPath, 0);
|
sl@0
|
796 |
else
|
sl@0
|
797 |
r = gFileMan->Move(srcPath, trgPath, 0, gStat);
|
sl@0
|
798 |
TestResult(r,KErrPathNotFound);
|
sl@0
|
799 |
|
sl@0
|
800 |
// clean up before leaving
|
sl@0
|
801 |
trgPath.Format(_L("%c:\\TestDEF130404\\"), (TUint8)gDriveToTest);
|
sl@0
|
802 |
RmDir(trgPath);
|
sl@0
|
803 |
RmDir(_L("C:\\TestDEF130404\\"));
|
sl@0
|
804 |
}
|
sl@0
|
805 |
|
sl@0
|
806 |
|
sl@0
|
807 |
/**
|
sl@0
|
808 |
This is to test that moving files to overwrite folders with the same names
|
sl@0
|
809 |
and moving folders (directories) to overwrite files with the same names
|
sl@0
|
810 |
across drives return proper error codes
|
sl@0
|
811 |
*/
|
sl@0
|
812 |
void TestPDEF137716()
|
sl@0
|
813 |
{
|
sl@0
|
814 |
// Do not run tests if we cannot move across different drives
|
sl@0
|
815 |
if (gSessionPath[0]=='C')
|
sl@0
|
816 |
return;
|
sl@0
|
817 |
|
sl@0
|
818 |
// Move FILE to overwrite FOLDER --------------------------------------------------------
|
sl@0
|
819 |
test.Next(_L("Test moving files to overwrite folders with the same names"));
|
sl@0
|
820 |
gFileMan->SetObserver(NULL);
|
sl@0
|
821 |
|
sl@0
|
822 |
_LIT(KFixedTargetTestFolder, "\\PDEF137716\\");
|
sl@0
|
823 |
_LIT(KFileToDirTargetCreatePath, "\\PDEF137716\\FileToDir_Target\\ITEM\\");
|
sl@0
|
824 |
_LIT(KFileToDirTargetNameWild, "\\PDEF137716\\FileToDir_Target\\");
|
sl@0
|
825 |
|
sl@0
|
826 |
_LIT(KFixedSourceTestFolder, "C:\\PDEF137716\\");
|
sl@0
|
827 |
_LIT(KFileToDirSourceName, "C:\\PDEF137716\\FileToDir_Source\\ITEM");
|
sl@0
|
828 |
_LIT(KFileToDirSourceNameWild, "C:\\PDEF137716\\FileToDir_Source\\");
|
sl@0
|
829 |
|
sl@0
|
830 |
RmDir(KFixedTargetTestFolder);
|
sl@0
|
831 |
RmDir(KFixedSourceTestFolder);
|
sl@0
|
832 |
MakeDir(KFileToDirTargetCreatePath);
|
sl@0
|
833 |
MakeFile(KFileToDirSourceName);
|
sl@0
|
834 |
TInt err = KErrNone;
|
sl@0
|
835 |
|
sl@0
|
836 |
if(!gAsynch)
|
sl@0
|
837 |
{
|
sl@0
|
838 |
err = gFileMan->Move(KFileToDirSourceName, KFileToDirTargetNameWild, 0);
|
sl@0
|
839 |
}
|
sl@0
|
840 |
else
|
sl@0
|
841 |
{
|
sl@0
|
842 |
err = gFileMan->Move(KFileToDirSourceName, KFileToDirTargetNameWild, 0, gStat);
|
sl@0
|
843 |
}
|
sl@0
|
844 |
TestResult(err,KErrAccessDenied);
|
sl@0
|
845 |
|
sl@0
|
846 |
RmDir(KFixedTargetTestFolder);
|
sl@0
|
847 |
RmDir(KFixedSourceTestFolder);
|
sl@0
|
848 |
MakeDir(KFileToDirTargetCreatePath);
|
sl@0
|
849 |
MakeFile(KFileToDirSourceName);
|
sl@0
|
850 |
if(!gAsynch)
|
sl@0
|
851 |
{
|
sl@0
|
852 |
err = gFileMan->Move(KFileToDirSourceName, KFileToDirTargetNameWild, CFileMan::EOverWrite);
|
sl@0
|
853 |
}
|
sl@0
|
854 |
else
|
sl@0
|
855 |
{
|
sl@0
|
856 |
err = gFileMan->Move(KFileToDirSourceName, KFileToDirTargetNameWild, CFileMan::EOverWrite, gStat);
|
sl@0
|
857 |
}
|
sl@0
|
858 |
TestResult(err,KErrAccessDenied);
|
sl@0
|
859 |
|
sl@0
|
860 |
RmDir(KFixedTargetTestFolder);
|
sl@0
|
861 |
RmDir(KFixedSourceTestFolder);
|
sl@0
|
862 |
MakeDir(KFileToDirTargetCreatePath);
|
sl@0
|
863 |
MakeFile(KFileToDirSourceName);
|
sl@0
|
864 |
if(!gAsynch)
|
sl@0
|
865 |
{
|
sl@0
|
866 |
err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, 0);
|
sl@0
|
867 |
}
|
sl@0
|
868 |
else
|
sl@0
|
869 |
{
|
sl@0
|
870 |
err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, 0, gStat);
|
sl@0
|
871 |
}
|
sl@0
|
872 |
TestResult(err,KErrAccessDenied);
|
sl@0
|
873 |
|
sl@0
|
874 |
RmDir(KFixedTargetTestFolder);
|
sl@0
|
875 |
RmDir(KFixedSourceTestFolder);
|
sl@0
|
876 |
MakeDir(KFileToDirTargetCreatePath);
|
sl@0
|
877 |
MakeFile(KFileToDirSourceName);
|
sl@0
|
878 |
if(!gAsynch)
|
sl@0
|
879 |
{
|
sl@0
|
880 |
err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, CFileMan::EOverWrite);
|
sl@0
|
881 |
}
|
sl@0
|
882 |
else
|
sl@0
|
883 |
{
|
sl@0
|
884 |
err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, CFileMan::EOverWrite, gStat);
|
sl@0
|
885 |
}
|
sl@0
|
886 |
TestResult(err,KErrAccessDenied);
|
sl@0
|
887 |
|
sl@0
|
888 |
|
sl@0
|
889 |
// Move FOLDER to overwrite FILE --------------------------------------------------------
|
sl@0
|
890 |
test.Next(_L("Test moving folders to overwrite files with the same names"));
|
sl@0
|
891 |
|
sl@0
|
892 |
_LIT(KDirToFileTargetName, "\\PDEF137716\\DirToFile_Target\\ITEM");
|
sl@0
|
893 |
_LIT(KDirToFileTargetNameWild, "\\PDEF137716\\DirToFile_Target\\");
|
sl@0
|
894 |
|
sl@0
|
895 |
_LIT(KDirToFileSourceName, "C:\\PDEF137716\\DirToFile_Source\\ITEM");
|
sl@0
|
896 |
_LIT(KDirToFileSourceNameWild, "C:\\PDEF137716\\DirToFile_Source\\");
|
sl@0
|
897 |
|
sl@0
|
898 |
_LIT(KDirToFileSourceCreatePath, "C:\\PDEF137716\\DirToFile_Source\\ITEM\\");
|
sl@0
|
899 |
|
sl@0
|
900 |
RmDir(KFixedTargetTestFolder);
|
sl@0
|
901 |
RmDir(KFixedSourceTestFolder);
|
sl@0
|
902 |
MakeFile(KDirToFileTargetName);
|
sl@0
|
903 |
MakeDir(KDirToFileSourceCreatePath);
|
sl@0
|
904 |
if(!gAsynch)
|
sl@0
|
905 |
{
|
sl@0
|
906 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, 0);
|
sl@0
|
907 |
}
|
sl@0
|
908 |
else
|
sl@0
|
909 |
{
|
sl@0
|
910 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, 0, gStat);
|
sl@0
|
911 |
}
|
sl@0
|
912 |
TestResult(err,KErrAccessDenied,KErrAccessDenied);
|
sl@0
|
913 |
|
sl@0
|
914 |
RmDir(KFixedTargetTestFolder);
|
sl@0
|
915 |
RmDir(KFixedSourceTestFolder);
|
sl@0
|
916 |
MakeFile(KDirToFileTargetName);
|
sl@0
|
917 |
MakeDir(KDirToFileSourceCreatePath);
|
sl@0
|
918 |
if(!gAsynch)
|
sl@0
|
919 |
{
|
sl@0
|
920 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, CFileMan::EOverWrite);
|
sl@0
|
921 |
}
|
sl@0
|
922 |
else
|
sl@0
|
923 |
{
|
sl@0
|
924 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, CFileMan::EOverWrite, gStat);
|
sl@0
|
925 |
}
|
sl@0
|
926 |
TestResult(err,KErrAccessDenied,KErrAccessDenied);
|
sl@0
|
927 |
|
sl@0
|
928 |
RmDir(KFixedTargetTestFolder);
|
sl@0
|
929 |
RmDir(KFixedSourceTestFolder);
|
sl@0
|
930 |
MakeFile(KDirToFileTargetName);
|
sl@0
|
931 |
MakeDir(KDirToFileSourceCreatePath);
|
sl@0
|
932 |
if(!gAsynch)
|
sl@0
|
933 |
{
|
sl@0
|
934 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, 0);
|
sl@0
|
935 |
}
|
sl@0
|
936 |
else
|
sl@0
|
937 |
{
|
sl@0
|
938 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, 0, gStat);
|
sl@0
|
939 |
}
|
sl@0
|
940 |
TestResult(err,KErrAccessDenied,KErrAccessDenied);
|
sl@0
|
941 |
|
sl@0
|
942 |
RmDir(KFixedTargetTestFolder);
|
sl@0
|
943 |
RmDir(KFixedSourceTestFolder);
|
sl@0
|
944 |
MakeFile(KDirToFileTargetName);
|
sl@0
|
945 |
MakeDir(KDirToFileSourceCreatePath);
|
sl@0
|
946 |
if(!gAsynch)
|
sl@0
|
947 |
{
|
sl@0
|
948 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, CFileMan::EOverWrite);
|
sl@0
|
949 |
}
|
sl@0
|
950 |
else
|
sl@0
|
951 |
{
|
sl@0
|
952 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, CFileMan::EOverWrite, gStat);
|
sl@0
|
953 |
}
|
sl@0
|
954 |
TestResult(err,KErrAccessDenied,KErrAccessDenied);
|
sl@0
|
955 |
|
sl@0
|
956 |
RmDir(KFixedTargetTestFolder);
|
sl@0
|
957 |
RmDir(KFixedSourceTestFolder);
|
sl@0
|
958 |
MakeFile(KDirToFileTargetName);
|
sl@0
|
959 |
MakeDir(KDirToFileSourceCreatePath);
|
sl@0
|
960 |
err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, 0);
|
sl@0
|
961 |
if(!gAsynch)
|
sl@0
|
962 |
{
|
sl@0
|
963 |
err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, 0);
|
sl@0
|
964 |
}
|
sl@0
|
965 |
else
|
sl@0
|
966 |
{
|
sl@0
|
967 |
err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, 0, gStat);
|
sl@0
|
968 |
}
|
sl@0
|
969 |
TestResult(err,KErrNotFound);
|
sl@0
|
970 |
|
sl@0
|
971 |
RmDir(KFixedTargetTestFolder);
|
sl@0
|
972 |
RmDir(KFixedSourceTestFolder);
|
sl@0
|
973 |
MakeFile(KDirToFileTargetName);
|
sl@0
|
974 |
MakeDir(KDirToFileSourceCreatePath);
|
sl@0
|
975 |
if(!gAsynch)
|
sl@0
|
976 |
{
|
sl@0
|
977 |
err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, CFileMan::EOverWrite);
|
sl@0
|
978 |
}
|
sl@0
|
979 |
else
|
sl@0
|
980 |
{
|
sl@0
|
981 |
err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, CFileMan::EOverWrite, gStat);
|
sl@0
|
982 |
}
|
sl@0
|
983 |
TestResult(err,KErrNotFound);
|
sl@0
|
984 |
|
sl@0
|
985 |
RmDir(KFixedTargetTestFolder);
|
sl@0
|
986 |
RmDir(KFixedSourceTestFolder);
|
sl@0
|
987 |
gFileMan->SetObserver(gObserver);
|
sl@0
|
988 |
}
|
sl@0
|
989 |
|
sl@0
|
990 |
LOCAL_C void TestMove()
|
sl@0
|
991 |
//
|
sl@0
|
992 |
// Test Move
|
sl@0
|
993 |
//
|
sl@0
|
994 |
{
|
sl@0
|
995 |
test.Next(_L("Test move"));
|
sl@0
|
996 |
RmDir(_L("\\F32-TST\\TFMAN\\MOVEDIR\\*"));
|
sl@0
|
997 |
|
sl@0
|
998 |
MakeDir(_L("\\F32-TST\\TFMAN\\MOVEDIR\\"));
|
sl@0
|
999 |
MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\"));
|
sl@0
|
1000 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
|
sl@0
|
1001 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT"));
|
sl@0
|
1002 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE3.TXT"));
|
sl@0
|
1003 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\FILE4.TXT"));
|
sl@0
|
1004 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EXE1.BIN"));
|
sl@0
|
1005 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\EXE2.BIN"));
|
sl@0
|
1006 |
|
sl@0
|
1007 |
TInt r=KErrNone;
|
sl@0
|
1008 |
|
sl@0
|
1009 |
if (testingInvalidPathLengths)
|
sl@0
|
1010 |
// Create a path of greater 256 characters by renaming a directory and check it can be
|
sl@0
|
1011 |
// manipulated (tests fix to F32)
|
sl@0
|
1012 |
{
|
sl@0
|
1013 |
MakeDir(_L("\\START\\LONG\\"));
|
sl@0
|
1014 |
MakeDir(_L("\\FINISH\\"));
|
sl@0
|
1015 |
MakeFile(_L("\\START\\LONG\\ABCDEFGH01ABCDEFGH01ABCDEFGH01ABCDEFGH01.txt"));
|
sl@0
|
1016 |
MakeFile(_L("\\START\\LONG\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt"));
|
sl@0
|
1017 |
MakeFile(_L("\\START\\LONG\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt"));
|
sl@0
|
1018 |
MakeFile(_L("\\START\\LONG\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.txt"));
|
sl@0
|
1019 |
r=gFileMan->Rename(_L("\\START\\LONG"),_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
|
sl@0
|
1020 |
test(r==KErrNone);
|
sl@0
|
1021 |
|
sl@0
|
1022 |
// Two long directory names - makes paths invalid
|
sl@0
|
1023 |
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ"));
|
sl@0
|
1024 |
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\"));
|
sl@0
|
1025 |
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04"));
|
sl@0
|
1026 |
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04"));
|
sl@0
|
1027 |
r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite);
|
sl@0
|
1028 |
test(r==KErrNone);
|
sl@0
|
1029 |
|
sl@0
|
1030 |
MakeDir(_L("\\START\\ASDFFDSA\\"));
|
sl@0
|
1031 |
}
|
sl@0
|
1032 |
|
sl@0
|
1033 |
//testing invalid source path at the beginning:
|
sl@0
|
1034 |
if (!gAsynch)
|
sl@0
|
1035 |
{
|
sl@0
|
1036 |
r=gFileMan->Move(_L(":C:\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
|
sl@0
|
1037 |
}
|
sl@0
|
1038 |
else
|
sl@0
|
1039 |
{
|
sl@0
|
1040 |
r=gFileMan->Move(_L(":C:\\F32-TST\\TFMAN\\DELDIR\\FILE?.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE*.TXT"),0,gStat);
|
sl@0
|
1041 |
}
|
sl@0
|
1042 |
TestResult(r,KErrBadName,KErrBadName);
|
sl@0
|
1043 |
|
sl@0
|
1044 |
//testing invalid target path at the beginning:
|
sl@0
|
1045 |
if (!gAsynch)
|
sl@0
|
1046 |
{
|
sl@0
|
1047 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L(":C:\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
|
sl@0
|
1048 |
}
|
sl@0
|
1049 |
else
|
sl@0
|
1050 |
{
|
sl@0
|
1051 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE?.TXT"),_L(":C:\\F32-TST\\TFMAN\\DELDIR\\FILE*.TXT"),0,gStat);
|
sl@0
|
1052 |
}
|
sl@0
|
1053 |
TestResult(r,KErrBadName,KErrBadName);
|
sl@0
|
1054 |
|
sl@0
|
1055 |
//testing invalid source path at the middle:
|
sl@0
|
1056 |
if (!gAsynch)
|
sl@0
|
1057 |
{
|
sl@0
|
1058 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\:DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
|
sl@0
|
1059 |
}
|
sl@0
|
1060 |
else
|
sl@0
|
1061 |
{
|
sl@0
|
1062 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\:DELDIR\\FILE?.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE*.TXT"),0,gStat);
|
sl@0
|
1063 |
}
|
sl@0
|
1064 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
1065 |
|
sl@0
|
1066 |
//testing invalid target path at the middle:
|
sl@0
|
1067 |
if (!gAsynch)
|
sl@0
|
1068 |
{
|
sl@0
|
1069 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\:DELDIR\\FILE1.TXT"));
|
sl@0
|
1070 |
}
|
sl@0
|
1071 |
else
|
sl@0
|
1072 |
{
|
sl@0
|
1073 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE?.TXT"),_L("\\F32-TST\\TFMAN\\:DELDIR\\FILE*.TXT"),0,gStat);
|
sl@0
|
1074 |
}
|
sl@0
|
1075 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
1076 |
|
sl@0
|
1077 |
//testing invalid source path at the end:
|
sl@0
|
1078 |
if (!gAsynch)
|
sl@0
|
1079 |
{
|
sl@0
|
1080 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\:FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
|
sl@0
|
1081 |
}
|
sl@0
|
1082 |
else
|
sl@0
|
1083 |
{
|
sl@0
|
1084 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\:FILE?.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE*.TXT"),0,gStat);
|
sl@0
|
1085 |
}
|
sl@0
|
1086 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
1087 |
|
sl@0
|
1088 |
//testing invalid target path at the end:
|
sl@0
|
1089 |
if (!gAsynch)
|
sl@0
|
1090 |
{
|
sl@0
|
1091 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\:FILE1.TXT"));
|
sl@0
|
1092 |
}
|
sl@0
|
1093 |
else
|
sl@0
|
1094 |
{
|
sl@0
|
1095 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE?.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\:FILE*.TXT"),0,gStat);
|
sl@0
|
1096 |
}
|
sl@0
|
1097 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
1098 |
|
sl@0
|
1099 |
|
sl@0
|
1100 |
if (!gAsynch)
|
sl@0
|
1101 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE?.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE*.TXT"));
|
sl@0
|
1102 |
else
|
sl@0
|
1103 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE?.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE*.TXT"),0,gStat);
|
sl@0
|
1104 |
TestResult(r,KErrNone);
|
sl@0
|
1105 |
|
sl@0
|
1106 |
if ((!gAsynch)&&(testingInvalidPathLengths))
|
sl@0
|
1107 |
{
|
sl@0
|
1108 |
r=gFileMan->Move(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"));
|
sl@0
|
1109 |
test(r==KErrNone);
|
sl@0
|
1110 |
|
sl@0
|
1111 |
r=gFileMan->Move(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\*.*"),_L("\\FINISH\\"), CFileMan::EOverWrite | CFileMan::ERecurse);
|
sl@0
|
1112 |
test(r==KErrNone);
|
sl@0
|
1113 |
|
sl@0
|
1114 |
r=gFileMan->RmDir(_L("\\START\\"));
|
sl@0
|
1115 |
test(r==KErrNone);
|
sl@0
|
1116 |
r=gFileMan->RmDir(_L("\\FINISH\\"));
|
sl@0
|
1117 |
test(r==KErrNone);
|
sl@0
|
1118 |
}
|
sl@0
|
1119 |
if ((gAsynch)&&(testingInvalidPathLengths))
|
sl@0
|
1120 |
{
|
sl@0
|
1121 |
r=gFileMan->Move(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1122 |
User::WaitForRequest(gStat);
|
sl@0
|
1123 |
test(r==KErrNone);
|
sl@0
|
1124 |
r=gFileMan->Move(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\*.*"),_L("\\FINISH\\"), CFileMan::EOverWrite | CFileMan::ERecurse,gStat);
|
sl@0
|
1125 |
User::WaitForRequest(gStat);
|
sl@0
|
1126 |
test(r==KErrNone);
|
sl@0
|
1127 |
r=gFileMan->RmDir(_L("\\START\\"),gStat);
|
sl@0
|
1128 |
WaitForSuccess();
|
sl@0
|
1129 |
test(r==KErrNone);
|
sl@0
|
1130 |
r=gFileMan->RmDir(_L("\\FINISH\\"),gStat);
|
sl@0
|
1131 |
WaitForSuccess();
|
sl@0
|
1132 |
test(r==KErrNone);
|
sl@0
|
1133 |
}
|
sl@0
|
1134 |
|
sl@0
|
1135 |
if (!gAsynch)
|
sl@0
|
1136 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
|
sl@0
|
1137 |
else
|
sl@0
|
1138 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),0,gStat);
|
sl@0
|
1139 |
TestResult(r,KErrNone);
|
sl@0
|
1140 |
|
sl@0
|
1141 |
if (!gAsynch)
|
sl@0
|
1142 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\MOVEDIR\\"));
|
sl@0
|
1143 |
else
|
sl@0
|
1144 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\MOVEDIR\\"),0,gStat);
|
sl@0
|
1145 |
TestResult(r);
|
sl@0
|
1146 |
|
sl@0
|
1147 |
if (!gAsynch)
|
sl@0
|
1148 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\MoveDIR.\\FILE*.TXT"));
|
sl@0
|
1149 |
else
|
sl@0
|
1150 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\MoveDIR\\FILE*.TXT"),0,gStat);
|
sl@0
|
1151 |
TestResult(r,KErrNotFound);
|
sl@0
|
1152 |
|
sl@0
|
1153 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
|
sl@0
|
1154 |
if (!gAsynch)
|
sl@0
|
1155 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\MoveDIR\\FILE1.TXT"),0);
|
sl@0
|
1156 |
else
|
sl@0
|
1157 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\MoveDIR\\FILE1.TXT"),0,gStat);
|
sl@0
|
1158 |
TestResult(r,KErrAlreadyExists);
|
sl@0
|
1159 |
r=TheFs.Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
|
sl@0
|
1160 |
test(r==KErrNone);
|
sl@0
|
1161 |
|
sl@0
|
1162 |
test.Next(_L("Check files have been moved"));
|
sl@0
|
1163 |
RmDir(_L("\\F32-TST\\TFMAN\\AFTER\\*"));
|
sl@0
|
1164 |
MakeDir(_L("\\F32-TST\\TFMAN\\AFTER\\DELTEST\\EMPTY\\"));
|
sl@0
|
1165 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELTEST\\FILE4.TXT"));
|
sl@0
|
1166 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELTEST\\EXE1.BIN"));
|
sl@0
|
1167 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\EXE2.BIN"));
|
sl@0
|
1168 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\DELDIR\\*"));
|
sl@0
|
1169 |
|
sl@0
|
1170 |
RmDir(_L("\\F32-TST\\TFMAN\\AFTER\\*"));
|
sl@0
|
1171 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE1.TXT"));
|
sl@0
|
1172 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE2.TXT"));
|
sl@0
|
1173 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE3.TXT"));
|
sl@0
|
1174 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\MOVEDIR\\*"));
|
sl@0
|
1175 |
|
sl@0
|
1176 |
if (testingInvalidPathLengths)
|
sl@0
|
1177 |
{
|
sl@0
|
1178 |
r=gFileMan->RmDir(_L("\\TEST\\"));
|
sl@0
|
1179 |
test(r==KErrNone);
|
sl@0
|
1180 |
}
|
sl@0
|
1181 |
|
sl@0
|
1182 |
TestDEF121663(); // Test moving directory to its subdirectory
|
sl@0
|
1183 |
TestDEF123575(); // Test moving directories where src and trg have matching subdirectory structures
|
sl@0
|
1184 |
TestDEF125570(); // Test move when trg has at least one of the src dirs
|
sl@0
|
1185 |
TestDEF130404(); // Test move when the src doesn't fully exist
|
sl@0
|
1186 |
if (!IsTestingLFFS())
|
sl@0
|
1187 |
TestPDEF137716(); // Test moving files to overwrite folders that have the same names
|
sl@0
|
1188 |
}
|
sl@0
|
1189 |
|
sl@0
|
1190 |
LOCAL_C void TestSimultaneous()
|
sl@0
|
1191 |
//
|
sl@0
|
1192 |
// Create and run two CFileMen simultaneously
|
sl@0
|
1193 |
//
|
sl@0
|
1194 |
{
|
sl@0
|
1195 |
test.Next(_L("Test create and run two CFileMans simultaneously"));
|
sl@0
|
1196 |
RmDir(_L("\\F32-TST\\TFMAN\\fman2\\"));
|
sl@0
|
1197 |
|
sl@0
|
1198 |
MakeDir(_L("\\F32-TST\\TFMAN\\FMAN1\\"));
|
sl@0
|
1199 |
MakeDir(_L("\\F32-TST\\TFMAN\\FMAN2\\"));
|
sl@0
|
1200 |
MakeFile(_L("\\F32-TST\\TFMAN\\FMAN1\\ROD.TXT"));
|
sl@0
|
1201 |
MakeFile(_L("\\F32-TST\\TFMAN\\FMAN1\\JANE.TXT"));
|
sl@0
|
1202 |
MakeFile(_L("\\F32-TST\\TFMAN\\FMAN1\\FREDDY.TXT"));
|
sl@0
|
1203 |
MakeFile(_L("\\F32-TST\\TFMAN\\FMAN2\\BORIS.TXT"));
|
sl@0
|
1204 |
MakeFile(_L("\\F32-TST\\TFMAN\\FMAN2\\FREDRICK.TXT"));
|
sl@0
|
1205 |
MakeFile(_L("\\F32-TST\\TFMAN\\FMAN2\\PETER.TXT"));
|
sl@0
|
1206 |
|
sl@0
|
1207 |
CFileMan* fman=CFileMan::NewL(TheFs);
|
sl@0
|
1208 |
TRequestStatus stat1;
|
sl@0
|
1209 |
TInt r=fman->Delete(_L("\\F32-TST\\TFMAN\\FMAN1\\*.*"),0,stat1);
|
sl@0
|
1210 |
test(r==KErrNone);
|
sl@0
|
1211 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\FMAN2\\*.TXT"),_L("\\F32-TST\\TFMAN\\FMAN2\\*.EXT"),0,gStat);
|
sl@0
|
1212 |
test(r==KErrNone);
|
sl@0
|
1213 |
FOREVER
|
sl@0
|
1214 |
{
|
sl@0
|
1215 |
if (stat1!=KRequestPending && gStat!=KRequestPending)
|
sl@0
|
1216 |
break;
|
sl@0
|
1217 |
User::WaitForAnyRequest();
|
sl@0
|
1218 |
}
|
sl@0
|
1219 |
test(stat1==KErrNone && gStat==KErrNone);
|
sl@0
|
1220 |
delete fman;
|
sl@0
|
1221 |
|
sl@0
|
1222 |
test.Next(_L("Check all files"));
|
sl@0
|
1223 |
RmDir(_L("\\F32-TST\\TFMAN\\AFTER\\*"));
|
sl@0
|
1224 |
|
sl@0
|
1225 |
MakeDir(_L("\\F32-TST\\TFMAN\\AFTER\\"));
|
sl@0
|
1226 |
Compare(_L("\\F32-TST\\TFMAN\\After\\*"),_L("\\F32-TST\\TFMAN\\FMAN1\\*"));
|
sl@0
|
1227 |
|
sl@0
|
1228 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\BORIS.EXT"));
|
sl@0
|
1229 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FREDRICK.EXT"));
|
sl@0
|
1230 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\PETER.EXT"));
|
sl@0
|
1231 |
Compare(_L("\\F32-TST\\TFMAN\\After\\*"),_L("\\F32-TST\\TFMAN\\FMAN2\\*"));
|
sl@0
|
1232 |
}
|
sl@0
|
1233 |
|
sl@0
|
1234 |
// Test wildcards are replaced with letters from the matched file (CFileMan::CreateTargetNameFromSource)
|
sl@0
|
1235 |
LOCAL_C void TestDEF092084()
|
sl@0
|
1236 |
{
|
sl@0
|
1237 |
if(gAsynch)
|
sl@0
|
1238 |
{
|
sl@0
|
1239 |
return;
|
sl@0
|
1240 |
}
|
sl@0
|
1241 |
test.Next(_L("Test wildcards are replaced with letters from the matched file (DEF092084)"));
|
sl@0
|
1242 |
MakeDir(_L("\\DEF092084"));
|
sl@0
|
1243 |
MakeFile(_L("\\DEF092084\\FILE1.TXT"));
|
sl@0
|
1244 |
|
sl@0
|
1245 |
TInt r = gFileMan->Rename(_L("\\DEF092084\\*.TXT"),_L("\\DEF092084\\*.DDB"), CFileMan::EOverWrite);
|
sl@0
|
1246 |
test(r==KErrNone);
|
sl@0
|
1247 |
CheckFileExists(_L("\\DEF092084\\FILE1.DDB"), KErrNone);
|
sl@0
|
1248 |
|
sl@0
|
1249 |
r = gFileMan->Rename(_L("\\DEF092084\\?*.DD?"),_L("\\DEF092084\\?*.TXT"), CFileMan::EOverWrite);
|
sl@0
|
1250 |
test(r==KErrNone);
|
sl@0
|
1251 |
CheckFileExists(_L("\\DEF092084\\FILE1.TXT"), KErrNone);
|
sl@0
|
1252 |
|
sl@0
|
1253 |
RmDir(_L("\\DEF092084\\"));
|
sl@0
|
1254 |
}
|
sl@0
|
1255 |
|
sl@0
|
1256 |
//---------------------------------------------
|
sl@0
|
1257 |
//! @SYMTestCaseID PBASE-T_FMAN-0542
|
sl@0
|
1258 |
//! @SYMTestType UT
|
sl@0
|
1259 |
//! @SYMREQ INC109754
|
sl@0
|
1260 |
//! @SYMTestCaseDesc 1. Tests that CFileMan::Rename() does not incorrectly remove empty source directory
|
sl@0
|
1261 |
//! @SYMTestActions Renames the only file from source directory to target directory, then check if
|
sl@0
|
1262 |
//! the empty source directory still exists.
|
sl@0
|
1263 |
//! 2. Tests the trailing backslash ("\") is interpreted to ("\*.*").
|
sl@0
|
1264 |
//! @SYMTestExpectedResults The operation completes with error code KErrNone;
|
sl@0
|
1265 |
//! The empty source directory still exists.
|
sl@0
|
1266 |
//! @SYMTestPriority High
|
sl@0
|
1267 |
//! @SYMTestStatus Implemented
|
sl@0
|
1268 |
//---------------------------------------------
|
sl@0
|
1269 |
void TestINC109754()
|
sl@0
|
1270 |
{
|
sl@0
|
1271 |
test.Next(_L("Test empty source directory should exist after contents being renamed (INC109754)"));
|
sl@0
|
1272 |
TInt r = KErrNone;
|
sl@0
|
1273 |
// Setting up comparing dir
|
sl@0
|
1274 |
RmDir( _L("\\F32-TST\\TFMAN\\INC109754_C\\"));
|
sl@0
|
1275 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC109754_C\\SRC\\"));
|
sl@0
|
1276 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC109754_C\\TRG\\FILE.TXT"));
|
sl@0
|
1277 |
|
sl@0
|
1278 |
// Setting up testing dir
|
sl@0
|
1279 |
RmDir( _L("\\F32-TST\\TFMAN\\INC109754\\"));
|
sl@0
|
1280 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC109754\\SRC\\FILE.TXT"));
|
sl@0
|
1281 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC109754\\TRG\\"));
|
sl@0
|
1282 |
|
sl@0
|
1283 |
// Test case 1: CFileMan::Rename(_L("C:\\SRC\\"), _L("C:\\TRG\\"));
|
sl@0
|
1284 |
if (!gAsynch)
|
sl@0
|
1285 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\INC109754\\SRC\\"),_L("\\F32-TST\\TFMAN\\INC109754\\TRG\\"));
|
sl@0
|
1286 |
else
|
sl@0
|
1287 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\INC109754\\SRC\\"),_L("\\F32-TST\\TFMAN\\INC109754\\TRG\\"),0,gStat);
|
sl@0
|
1288 |
TestResult(r);
|
sl@0
|
1289 |
Compare(_L("\\F32-TST\\TFMAN\\INC109754\\"), _L("\\F32-TST\\TFMAN\\INC109754_C\\"));
|
sl@0
|
1290 |
|
sl@0
|
1291 |
// Setting up testing dir
|
sl@0
|
1292 |
RmDir( _L("\\F32-TST\\TFMAN\\INC109754\\"));
|
sl@0
|
1293 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC109754\\SRC\\FILE.TXT"));
|
sl@0
|
1294 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC109754\\TRG\\"));
|
sl@0
|
1295 |
|
sl@0
|
1296 |
// Test case 2: CFileMan::Rename(_L("C:\\SRC\\*.*"), _L("C:\\TRG\\"));
|
sl@0
|
1297 |
if (!gAsynch)
|
sl@0
|
1298 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\INC109754\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\INC109754\\TRG\\"));
|
sl@0
|
1299 |
else
|
sl@0
|
1300 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\INC109754\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\INC109754\\TRG\\"),0,gStat);
|
sl@0
|
1301 |
TestResult(r);
|
sl@0
|
1302 |
Compare(_L("\\F32-TST\\TFMAN\\INC109754\\"), _L("\\F32-TST\\TFMAN\\INC109754_C\\"));
|
sl@0
|
1303 |
}
|
sl@0
|
1304 |
|
sl@0
|
1305 |
|
sl@0
|
1306 |
/*
|
sl@0
|
1307 |
Test code for INC111038() and executed with Cache enabled and FS_NOT_RUGGED.
|
sl@0
|
1308 |
*/
|
sl@0
|
1309 |
LOCAL_C void TestINC111038()
|
sl@0
|
1310 |
{
|
sl@0
|
1311 |
TInt r;
|
sl@0
|
1312 |
test.Next(_L("Test example of incorrect attribute flushing"));
|
sl@0
|
1313 |
|
sl@0
|
1314 |
_LIT(KTestFile, "\\TESTFILE.TXT");
|
sl@0
|
1315 |
|
sl@0
|
1316 |
test.Printf(_L("1: Create Test File\n"));
|
sl@0
|
1317 |
RFile testFile;
|
sl@0
|
1318 |
r = testFile.Create(TheFs, KTestFile, EFileRead | EFileWrite);
|
sl@0
|
1319 |
test(r == KErrNone);
|
sl@0
|
1320 |
|
sl@0
|
1321 |
test.Printf(_L("2: Populate testFile1 Data\n"));
|
sl@0
|
1322 |
r = testFile.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
|
sl@0
|
1323 |
test(r == KErrNone);
|
sl@0
|
1324 |
|
sl@0
|
1325 |
test.Printf(_L("3: Get Initial Attributes\n"));
|
sl@0
|
1326 |
TUint atts = 0;
|
sl@0
|
1327 |
r = testFile.Att(atts);
|
sl@0
|
1328 |
test(r == KErrNone);
|
sl@0
|
1329 |
test.Printf(_L(" Attributes: %08x"), atts);
|
sl@0
|
1330 |
|
sl@0
|
1331 |
test.Printf(_L("4: Set KEntryAttHidden Attribute\n"));
|
sl@0
|
1332 |
r = testFile.SetAtt(KEntryAttHidden, 0);
|
sl@0
|
1333 |
test(r == KErrNone);
|
sl@0
|
1334 |
|
sl@0
|
1335 |
test.Printf(_L("5: Verify KEntryAttHidden Attribute is set for testFile1\n"));
|
sl@0
|
1336 |
r = testFile.Att(atts);
|
sl@0
|
1337 |
test(r == KErrNone);
|
sl@0
|
1338 |
test(atts & KEntryAttHidden);
|
sl@0
|
1339 |
|
sl@0
|
1340 |
test.Printf(_L("6: Read Data from beginning of file testFile1\n"));
|
sl@0
|
1341 |
TBuf8<4> data;
|
sl@0
|
1342 |
r = testFile.Read(0, data);
|
sl@0
|
1343 |
test(r == KErrNone);
|
sl@0
|
1344 |
|
sl@0
|
1345 |
test.Printf(_L("7: Close all the testFiles\n"));
|
sl@0
|
1346 |
testFile.Close();
|
sl@0
|
1347 |
|
sl@0
|
1348 |
test.Printf(_L("8: Verify KEntryAttHidden is present\n"));
|
sl@0
|
1349 |
r = TheFs.Att(KTestFile, atts);
|
sl@0
|
1350 |
test(r == KErrNone);
|
sl@0
|
1351 |
test.Printf(_L(" Finally, attributes are : %08x\n"), atts);
|
sl@0
|
1352 |
test(atts & KEntryAttHidden);
|
sl@0
|
1353 |
|
sl@0
|
1354 |
test.Printf(_L("9: Delete Test File\n"));
|
sl@0
|
1355 |
r = TheFs.Delete(KTestFile);
|
sl@0
|
1356 |
test(r == KErrNone || r == KErrNotFound);
|
sl@0
|
1357 |
}
|
sl@0
|
1358 |
|
sl@0
|
1359 |
LOCAL_C void TestDEF113299()
|
sl@0
|
1360 |
{
|
sl@0
|
1361 |
test.Next(_L("Test invalid file rename (DEF113299)"));
|
sl@0
|
1362 |
|
sl@0
|
1363 |
TInt err =0;
|
sl@0
|
1364 |
TFileName srcFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\corner.html");
|
sl@0
|
1365 |
TFileName trgFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\mi?d**dle.html");
|
sl@0
|
1366 |
TFileName trgInvalidFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\mi?d**dle>.html"); // Invalid filename
|
sl@0
|
1367 |
TFileName renamedFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\mirderdle.html");
|
sl@0
|
1368 |
|
sl@0
|
1369 |
RmDir(_L("C:\\F32-TST\\TFMAN\\DEF113299\\"));
|
sl@0
|
1370 |
MakeFile(srcFileName,_L8("Test Data"));
|
sl@0
|
1371 |
|
sl@0
|
1372 |
// Renaming a file with invalid special characters should fail with error code KErrBadName(-28)
|
sl@0
|
1373 |
if (!gAsynch)
|
sl@0
|
1374 |
err = gFileMan->Rename(srcFileName,trgInvalidFileName);
|
sl@0
|
1375 |
else
|
sl@0
|
1376 |
err = gFileMan->Rename(srcFileName,trgInvalidFileName, 0, gStat);
|
sl@0
|
1377 |
TestResult(err,KErrBadName);
|
sl@0
|
1378 |
|
sl@0
|
1379 |
if(!gAsynch)
|
sl@0
|
1380 |
err = gFileMan->Rename(srcFileName,trgFileName);
|
sl@0
|
1381 |
else
|
sl@0
|
1382 |
err = gFileMan->Rename(srcFileName,trgFileName, 0, gStat);
|
sl@0
|
1383 |
TestResult(err,KErrNone);
|
sl@0
|
1384 |
|
sl@0
|
1385 |
CheckFileExists(renamedFileName,KErrNone,ETrue);
|
sl@0
|
1386 |
}
|
sl@0
|
1387 |
|
sl@0
|
1388 |
LOCAL_C void TestRename()
|
sl@0
|
1389 |
//
|
sl@0
|
1390 |
// Test rename with wildcards
|
sl@0
|
1391 |
//
|
sl@0
|
1392 |
{
|
sl@0
|
1393 |
test.Next(_L("Test rename with wildcards"));
|
sl@0
|
1394 |
RmDir(_L("\\F32-TST\\TFMAN\\rename\\dest\\"));
|
sl@0
|
1395 |
|
sl@0
|
1396 |
MakeDir(_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\"));
|
sl@0
|
1397 |
MakeDir(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\DirTest\\"));
|
sl@0
|
1398 |
MakeFile(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\abcDEF.TXT"));
|
sl@0
|
1399 |
MakeFile(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\abxx.TXT"));
|
sl@0
|
1400 |
MakeFile(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\HELLO.SPG"));
|
sl@0
|
1401 |
MakeFile(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\SHEET1.SPR"));
|
sl@0
|
1402 |
MakeFile(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\DirTest.TXT\\Unchanged.txt"));
|
sl@0
|
1403 |
|
sl@0
|
1404 |
TInt r;
|
sl@0
|
1405 |
|
sl@0
|
1406 |
if (testingInvalidPathLengths)
|
sl@0
|
1407 |
// Create a path of greater 256 characters by renaming a directory and check it can be
|
sl@0
|
1408 |
// manipulated (tests fix to F32)
|
sl@0
|
1409 |
{
|
sl@0
|
1410 |
MakeDir(_L("\\LONGNAME\\"));
|
sl@0
|
1411 |
MakeDir(_L("\\LONGNAME\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\"));
|
sl@0
|
1412 |
MakeFile(_L("\\LONGNAME\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt"));
|
sl@0
|
1413 |
MakeFile(_L("\\LONGNAME\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt"));
|
sl@0
|
1414 |
MakeFile(_L("\\LONGNAME\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.bin"));
|
sl@0
|
1415 |
r=gFileMan->Rename(_L("\\LONGNAME"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
|
sl@0
|
1416 |
test(r==KErrNone);
|
sl@0
|
1417 |
|
sl@0
|
1418 |
// Two long directory names - makes paths invalid
|
sl@0
|
1419 |
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ"));
|
sl@0
|
1420 |
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\"));
|
sl@0
|
1421 |
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT.txt"));
|
sl@0
|
1422 |
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE.txt"));
|
sl@0
|
1423 |
r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite);
|
sl@0
|
1424 |
test(r==KErrNone);
|
sl@0
|
1425 |
}
|
sl@0
|
1426 |
|
sl@0
|
1427 |
//testing invalid source path at the beginning:
|
sl@0
|
1428 |
if (!gAsynch)
|
sl@0
|
1429 |
{
|
sl@0
|
1430 |
r=gFileMan->Rename(_L("::C\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite);
|
sl@0
|
1431 |
}
|
sl@0
|
1432 |
else
|
sl@0
|
1433 |
{
|
sl@0
|
1434 |
r=gFileMan->Rename(_L("::C\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1435 |
}
|
sl@0
|
1436 |
TestResult(r,KErrBadName,KErrBadName);
|
sl@0
|
1437 |
|
sl@0
|
1438 |
//testing invalid target path at the beginning:
|
sl@0
|
1439 |
|
sl@0
|
1440 |
if (!gAsynch)
|
sl@0
|
1441 |
{
|
sl@0
|
1442 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("::C\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite);
|
sl@0
|
1443 |
}
|
sl@0
|
1444 |
else
|
sl@0
|
1445 |
{
|
sl@0
|
1446 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("::C\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1447 |
}
|
sl@0
|
1448 |
TestResult(r,KErrBadName,KErrBadName);
|
sl@0
|
1449 |
|
sl@0
|
1450 |
//testing invalid source path at the middle:
|
sl@0
|
1451 |
if (!gAsynch)
|
sl@0
|
1452 |
{
|
sl@0
|
1453 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\:RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite);
|
sl@0
|
1454 |
}
|
sl@0
|
1455 |
else
|
sl@0
|
1456 |
{
|
sl@0
|
1457 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\:RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1458 |
}
|
sl@0
|
1459 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
1460 |
|
sl@0
|
1461 |
//testing invalid target path at the middle:
|
sl@0
|
1462 |
if (!gAsynch)
|
sl@0
|
1463 |
{
|
sl@0
|
1464 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\:RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite);
|
sl@0
|
1465 |
}
|
sl@0
|
1466 |
else
|
sl@0
|
1467 |
{
|
sl@0
|
1468 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\:RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1469 |
}
|
sl@0
|
1470 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
1471 |
|
sl@0
|
1472 |
//testing invalid source path at the end:
|
sl@0
|
1473 |
if (!gAsynch)
|
sl@0
|
1474 |
{
|
sl@0
|
1475 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\:*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite);
|
sl@0
|
1476 |
}
|
sl@0
|
1477 |
else
|
sl@0
|
1478 |
{
|
sl@0
|
1479 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\:*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1480 |
}
|
sl@0
|
1481 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
1482 |
|
sl@0
|
1483 |
//testing invalid target path at the end:
|
sl@0
|
1484 |
if (!gAsynch)
|
sl@0
|
1485 |
{
|
sl@0
|
1486 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\:*.DDB"),CFileMan::EOverWrite);
|
sl@0
|
1487 |
}
|
sl@0
|
1488 |
else
|
sl@0
|
1489 |
{
|
sl@0
|
1490 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\:*.DDB"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1491 |
}
|
sl@0
|
1492 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
1493 |
|
sl@0
|
1494 |
if (!gAsynch)
|
sl@0
|
1495 |
{
|
sl@0
|
1496 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite);
|
sl@0
|
1497 |
test(r==KErrNone);
|
sl@0
|
1498 |
if (testingInvalidPathLengths)
|
sl@0
|
1499 |
{
|
sl@0
|
1500 |
r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.txt"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.bin"));
|
sl@0
|
1501 |
test(r==KErrBadName);
|
sl@0
|
1502 |
r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),_L("\\Shortened"),CFileMan::EOverWrite);
|
sl@0
|
1503 |
test(r==KErrNone);
|
sl@0
|
1504 |
r=gFileMan->Rename(_L("\\Shortened\\*.txt"),_L("\\Shortened\\*.cat"));
|
sl@0
|
1505 |
test(r==KErrNone);
|
sl@0
|
1506 |
r=gFileMan->RmDir(_L("\\Shortened\\"));
|
sl@0
|
1507 |
test(r==KErrNone);
|
sl@0
|
1508 |
|
sl@0
|
1509 |
r=gFileMan->Rename(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\NotSoShortened"),CFileMan::EOverWrite);
|
sl@0
|
1510 |
test(r==KErrNone);
|
sl@0
|
1511 |
r=gFileMan->Rename(_L("\\TEST"),_L("\\OXO!"));
|
sl@0
|
1512 |
test(r==KErrNone);
|
sl@0
|
1513 |
r=gFileMan->Rename(_L("\\OXO!\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as"),_L("\\OXO!\\Shorter"));
|
sl@0
|
1514 |
test(r==KErrNone);
|
sl@0
|
1515 |
r=gFileMan->Rename(_L("\\OXO!\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.txt"),_L("\\TEST\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.cat"));
|
sl@0
|
1516 |
test(r==KErrNone);
|
sl@0
|
1517 |
r=gFileMan->RmDir(_L("\\OXO!\\"));
|
sl@0
|
1518 |
test(r==KErrNone);
|
sl@0
|
1519 |
|
sl@0
|
1520 |
}
|
sl@0
|
1521 |
}
|
sl@0
|
1522 |
else
|
sl@0
|
1523 |
{
|
sl@0
|
1524 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1525 |
WaitForSuccess();
|
sl@0
|
1526 |
if (testingInvalidPathLengths)
|
sl@0
|
1527 |
{
|
sl@0
|
1528 |
r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.txt"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.bin"));
|
sl@0
|
1529 |
test(r==KErrBadName);
|
sl@0
|
1530 |
r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),_L("\\Shortened"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1531 |
WaitForSuccess();
|
sl@0
|
1532 |
r=gFileMan->Rename(_L("\\Shortened\\*.txt"),_L("\\Shortened\\*.bin"),0,gStat);
|
sl@0
|
1533 |
WaitForSuccess();
|
sl@0
|
1534 |
r=gFileMan->RmDir(_L("\\Shortened\\"),gStat);
|
sl@0
|
1535 |
WaitForSuccess();
|
sl@0
|
1536 |
|
sl@0
|
1537 |
r=gFileMan->Rename(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\NotSoShortened"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1538 |
WaitForSuccess();
|
sl@0
|
1539 |
test(r==KErrNone);
|
sl@0
|
1540 |
r=gFileMan->Rename(_L("\\TEST"),_L("\\OXO!"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1541 |
WaitForSuccess();
|
sl@0
|
1542 |
test(r==KErrNone);
|
sl@0
|
1543 |
r=gFileMan->Rename(_L("\\OXO!\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as"),_L("\\OXO!\\Shorter"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1544 |
WaitForSuccess();
|
sl@0
|
1545 |
test(r==KErrNone);
|
sl@0
|
1546 |
r=gFileMan->Rename(_L("\\OXO!\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.txt"),_L("\\TEST\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.cat"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1547 |
WaitForSuccess();
|
sl@0
|
1548 |
test(r==KErrNone);
|
sl@0
|
1549 |
r=gFileMan->RmDir(_L("\\OXO!\\"));
|
sl@0
|
1550 |
test(r==KErrNone);
|
sl@0
|
1551 |
r=gFileMan->RmDir(_L("\\TEST\\"));
|
sl@0
|
1552 |
test(r==KErrNone);
|
sl@0
|
1553 |
}
|
sl@0
|
1554 |
}
|
sl@0
|
1555 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\"));
|
sl@0
|
1556 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\abcDEF.DDB"));
|
sl@0
|
1557 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\abxx.DDB"));
|
sl@0
|
1558 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DirTest.DDB\\Unchanged.txt"));
|
sl@0
|
1559 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*"));
|
sl@0
|
1560 |
|
sl@0
|
1561 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\"));
|
sl@0
|
1562 |
MakeDir(_L("\\F32-TST\\TFMAN\\AFTER\\DirTest\\"));
|
sl@0
|
1563 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\HELLO.SPG"));
|
sl@0
|
1564 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\SHEET1.SPR"));
|
sl@0
|
1565 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*"));
|
sl@0
|
1566 |
|
sl@0
|
1567 |
if (!gAsynch)
|
sl@0
|
1568 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.TXT"));
|
sl@0
|
1569 |
else
|
sl@0
|
1570 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.TXT"),0,gStat);
|
sl@0
|
1571 |
TestResult(r);
|
sl@0
|
1572 |
|
sl@0
|
1573 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\"));
|
sl@0
|
1574 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\abcDEF.TXT"));
|
sl@0
|
1575 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\abxx.TXT"));
|
sl@0
|
1576 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DirTest.TXT\\Unchanged.txt"));
|
sl@0
|
1577 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*"));
|
sl@0
|
1578 |
|
sl@0
|
1579 |
test.Next(_L("Test rename case of filenames"));
|
sl@0
|
1580 |
MakeFile(_L("\\F32-TST\\TFMAN\\CASETEST\\FileName1"));
|
sl@0
|
1581 |
|
sl@0
|
1582 |
if (!gAsynch)
|
sl@0
|
1583 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\CASETEST\\FileName1"),_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"));
|
sl@0
|
1584 |
else
|
sl@0
|
1585 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\CASETEST\\FileName1"),_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),0,gStat);
|
sl@0
|
1586 |
TestResult(r);
|
sl@0
|
1587 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CASETEST\\FileName1"),KErrNone,EFalse);
|
sl@0
|
1588 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),KErrNone,ETrue);
|
sl@0
|
1589 |
|
sl@0
|
1590 |
if (!gAsynch)
|
sl@0
|
1591 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),CFileMan::EOverWrite);
|
sl@0
|
1592 |
else
|
sl@0
|
1593 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),CFileMan::EOverWrite,gStat);
|
sl@0
|
1594 |
TestResult(r);
|
sl@0
|
1595 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),KErrNone,ETrue);
|
sl@0
|
1596 |
|
sl@0
|
1597 |
// Test behaviour for omitted parameters
|
sl@0
|
1598 |
// For this, default should be session path
|
sl@0
|
1599 |
TFileName sessionPath;
|
sl@0
|
1600 |
TInt err=TheFs.SessionPath(sessionPath);
|
sl@0
|
1601 |
test(err==KErrNone);
|
sl@0
|
1602 |
|
sl@0
|
1603 |
SetupDirectories(ETrue, NULL);
|
sl@0
|
1604 |
err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\dest\\"));
|
sl@0
|
1605 |
test(err == KErrNone);
|
sl@0
|
1606 |
|
sl@0
|
1607 |
err = gFileMan->Rename(_L("\\F32-TST\\TFMAN\\source"), _L(""));
|
sl@0
|
1608 |
test(err == KErrNone);
|
sl@0
|
1609 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*"));
|
sl@0
|
1610 |
|
sl@0
|
1611 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\"));
|
sl@0
|
1612 |
RmDir(_L("\\F32-TST\\TFMAN\\source\\"));
|
sl@0
|
1613 |
SetupDirectories(ETrue, NULL);
|
sl@0
|
1614 |
err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\"));
|
sl@0
|
1615 |
test(err == KErrNone);
|
sl@0
|
1616 |
|
sl@0
|
1617 |
err = gFileMan->Rename(_L(""), _L("\\F32-TST\\TFMAN\\dest\\"));
|
sl@0
|
1618 |
test(err == KErrNone);
|
sl@0
|
1619 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*"));
|
sl@0
|
1620 |
|
sl@0
|
1621 |
err=TheFs.SetSessionPath(sessionPath);
|
sl@0
|
1622 |
test(err==KErrNone);
|
sl@0
|
1623 |
|
sl@0
|
1624 |
TestINC109754(); // Test empty source directory should exist after contents being renamed
|
sl@0
|
1625 |
TestDEF092084(); // Test wildcards are replaced with letters from the matched file
|
sl@0
|
1626 |
TestDEF113299(); // Test invalid file rename
|
sl@0
|
1627 |
}
|
sl@0
|
1628 |
|
sl@0
|
1629 |
LOCAL_C void TestAttribs()
|
sl@0
|
1630 |
//
|
sl@0
|
1631 |
// Test attribs
|
sl@0
|
1632 |
//
|
sl@0
|
1633 |
{
|
sl@0
|
1634 |
test.Next(_L("Test set file attributes"));
|
sl@0
|
1635 |
MakeFile(_L("\\F32-TST\\TFMAN\\ATTRIBS\\Attrib1.AT"));
|
sl@0
|
1636 |
MakeFile(_L("\\F32-TST\\TFMAN\\ATTRIBS\\Attrib2.at"));
|
sl@0
|
1637 |
|
sl@0
|
1638 |
TUint legalAttMask=KEntryAttMaskSupported&~(KEntryAttDir|KEntryAttVolume);
|
sl@0
|
1639 |
TUint setMask=KEntryAttReadOnly;
|
sl@0
|
1640 |
TUint clearMask=KEntryAttHidden|KEntryAttArchive;
|
sl@0
|
1641 |
if (!gAsynch)
|
sl@0
|
1642 |
{
|
sl@0
|
1643 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),setMask,clearMask,TTime(0));
|
sl@0
|
1644 |
test(r==KErrNone);
|
sl@0
|
1645 |
}
|
sl@0
|
1646 |
else
|
sl@0
|
1647 |
{
|
sl@0
|
1648 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),setMask,clearMask,TTime(0),0,gStat);
|
sl@0
|
1649 |
test(r==KErrNone);
|
sl@0
|
1650 |
WaitForSuccess();
|
sl@0
|
1651 |
}
|
sl@0
|
1652 |
|
sl@0
|
1653 |
CDirScan* scan=CDirScan::NewL(TheFs);
|
sl@0
|
1654 |
scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\ATTRIBS\\*"),KEntryAttMaskSupported,ESortByName);
|
sl@0
|
1655 |
CDir* entryList;
|
sl@0
|
1656 |
scan->NextL(entryList);
|
sl@0
|
1657 |
TInt count=entryList->Count();
|
sl@0
|
1658 |
test(count==2);
|
sl@0
|
1659 |
TEntry entry=(*entryList)[0];
|
sl@0
|
1660 |
test(entry.iName.MatchF(_L("attrib1.AT"))!=KErrNotFound);
|
sl@0
|
1661 |
test(entry.iAtt==KEntryAttReadOnly);
|
sl@0
|
1662 |
entry=(*entryList)[1];
|
sl@0
|
1663 |
test(entry.iName.MatchF(_L("attrib2.AT"))!=KErrNotFound);
|
sl@0
|
1664 |
test(entry.iAtt==KEntryAttReadOnly);
|
sl@0
|
1665 |
delete entryList;
|
sl@0
|
1666 |
|
sl@0
|
1667 |
TDateTime dateTime(1990,ENovember,20,9,5,0,0);
|
sl@0
|
1668 |
TTime time(dateTime); // FAT loses microseconds if try to convert HomeTime()
|
sl@0
|
1669 |
|
sl@0
|
1670 |
if (!gAsynch)
|
sl@0
|
1671 |
{
|
sl@0
|
1672 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),0,legalAttMask,time);
|
sl@0
|
1673 |
test(r==KErrNone);
|
sl@0
|
1674 |
}
|
sl@0
|
1675 |
else
|
sl@0
|
1676 |
{
|
sl@0
|
1677 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),0,legalAttMask,time,0,gStat);
|
sl@0
|
1678 |
test(r==KErrNone);
|
sl@0
|
1679 |
WaitForSuccess();
|
sl@0
|
1680 |
}
|
sl@0
|
1681 |
|
sl@0
|
1682 |
scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\ATTRIBS\\*"),KEntryAttMaskSupported,ESortByName);
|
sl@0
|
1683 |
scan->NextL(entryList);
|
sl@0
|
1684 |
count=entryList->Count();
|
sl@0
|
1685 |
test(count==2);
|
sl@0
|
1686 |
entry=(*entryList)[0];
|
sl@0
|
1687 |
test(entry.iName.MatchF(_L("attrib1.AT"))!=KErrNotFound);
|
sl@0
|
1688 |
test(entry.iAtt==0);
|
sl@0
|
1689 |
TDateTime dt=(entry.iModified).DateTime();
|
sl@0
|
1690 |
test(dt.Year()==dateTime.Year());
|
sl@0
|
1691 |
test(dt.Month()==dateTime.Month());
|
sl@0
|
1692 |
test(dt.Day()==dateTime.Day());
|
sl@0
|
1693 |
test(dt.Hour()==dateTime.Hour());
|
sl@0
|
1694 |
test(dt.Minute()==dateTime.Minute());
|
sl@0
|
1695 |
test(dt.Second()==dateTime.Second());
|
sl@0
|
1696 |
test(entry.iModified==time);
|
sl@0
|
1697 |
entry=(*entryList)[1];
|
sl@0
|
1698 |
test(entry.iName.MatchF(_L("attrib2.AT"))!=KErrNotFound);
|
sl@0
|
1699 |
test(entry.iAtt==0);
|
sl@0
|
1700 |
test(entry.iModified==time);
|
sl@0
|
1701 |
delete entryList;
|
sl@0
|
1702 |
delete scan;
|
sl@0
|
1703 |
|
sl@0
|
1704 |
TestINC111038(); // Test example of incorrect attribute flushing
|
sl@0
|
1705 |
}
|
sl@0
|
1706 |
|
sl@0
|
1707 |
LOCAL_C void TestINC091841()
|
sl@0
|
1708 |
{
|
sl@0
|
1709 |
if(gAsynch)
|
sl@0
|
1710 |
{
|
sl@0
|
1711 |
return;
|
sl@0
|
1712 |
}
|
sl@0
|
1713 |
|
sl@0
|
1714 |
test.Next(_L("Test delete long fullnames (INC091841)"));
|
sl@0
|
1715 |
MakeDir(_L("\\12345678\\Book\\12345678\\"));
|
sl@0
|
1716 |
TFileName longname;
|
sl@0
|
1717 |
longname.Copy(_L("\\12345678\\Book\\12345678\\12345678901234567890123456789012345678901234567890.x"));
|
sl@0
|
1718 |
MakeFile(longname);
|
sl@0
|
1719 |
TFileName oldname = longname;
|
sl@0
|
1720 |
TInt ret = KErrNone;
|
sl@0
|
1721 |
while(ret == KErrNone)
|
sl@0
|
1722 |
{
|
sl@0
|
1723 |
oldname = longname;
|
sl@0
|
1724 |
longname.Append(_L("xxxxx"));
|
sl@0
|
1725 |
ret = TheFs.Replace(oldname, longname);
|
sl@0
|
1726 |
}
|
sl@0
|
1727 |
if(oldname.Length() >= KMaxFileName-5) // if not, it means that we won't be calling ShrinkNames !!
|
sl@0
|
1728 |
{
|
sl@0
|
1729 |
TInt r = gFileMan->Rename(_L("\\12345678\\Book\\12345678"),_L("\\INC091841\\Book\\012-235-abcd"),0);
|
sl@0
|
1730 |
test(r==KErrNone);
|
sl@0
|
1731 |
CDir* dir;
|
sl@0
|
1732 |
r = TheFs.GetDir(_L("\\INC091841\\Book\\012-235-abcd\\"), KEntryAttNormal, ESortNone, dir);
|
sl@0
|
1733 |
test(r==KErrNone);
|
sl@0
|
1734 |
r = KErrNotFound;
|
sl@0
|
1735 |
TInt dirlen = sizeof("\\INC091841\\Book\\012-235-abcd\\");
|
sl@0
|
1736 |
for(TInt i=0; r==KErrNotFound && i<dir->Count(); i++)
|
sl@0
|
1737 |
{
|
sl@0
|
1738 |
if((*dir)[i].iName.Length() + dirlen > oldname.Length())
|
sl@0
|
1739 |
{
|
sl@0
|
1740 |
r = KErrNone;
|
sl@0
|
1741 |
}
|
sl@0
|
1742 |
}
|
sl@0
|
1743 |
delete dir;
|
sl@0
|
1744 |
test(r==KErrNone);
|
sl@0
|
1745 |
r = gFileMan->RmDir(_L("\\INC091841\\"));
|
sl@0
|
1746 |
test(r==KErrNone);
|
sl@0
|
1747 |
}
|
sl@0
|
1748 |
RmDir(_L("\\12345678\\"));
|
sl@0
|
1749 |
}
|
sl@0
|
1750 |
|
sl@0
|
1751 |
LOCAL_C void TestRmDir()
|
sl@0
|
1752 |
//
|
sl@0
|
1753 |
// Test rmdir function
|
sl@0
|
1754 |
//
|
sl@0
|
1755 |
{
|
sl@0
|
1756 |
test.Next(_L("Test rmdir function"));
|
sl@0
|
1757 |
|
sl@0
|
1758 |
MakeDir(_L("\\F32-TST\\TFMAN\\RMDIR\\EMPTY\\"));
|
sl@0
|
1759 |
MakeFile(_L("\\F32-TST\\TFMAN\\RMDIR\\ALFRED.txt"));
|
sl@0
|
1760 |
MakeFile(_L("\\F32-TST\\TFMAN\\RMDIR\\RICHARD.txt"));
|
sl@0
|
1761 |
MakeFile(_L("\\F32-TST\\TFMAN\\RMDIR\\RMSUBDIR1\\RMSUBSUBDIR\\CHARLES.txt"));
|
sl@0
|
1762 |
MakeFile(_L("\\F32-TST\\TFMAN\\RMDIR\\RMSUBDIR2\\EDMUND.txt"));
|
sl@0
|
1763 |
MakeDir(_L("\\F32-TST\\TFMAN\\TESTDIR\\"));
|
sl@0
|
1764 |
MakeFile(_L("\\F32-TST\\TFMAN\\TESTDIR\\DEF123044.txt"));
|
sl@0
|
1765 |
|
sl@0
|
1766 |
TInt r;
|
sl@0
|
1767 |
|
sl@0
|
1768 |
if (testingInvalidPathLengths)
|
sl@0
|
1769 |
// Create a path of greater 256 characters by renaming a directory and check it can be
|
sl@0
|
1770 |
// manipulated (tests fix to F32)
|
sl@0
|
1771 |
{
|
sl@0
|
1772 |
MakeDir(_L("\\LONGNAMETEST\\"));
|
sl@0
|
1773 |
MakeDir(_L("\\LONGNAMETEST\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\"));
|
sl@0
|
1774 |
MakeFile(_L("\\LONGNAMETEST\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04"));
|
sl@0
|
1775 |
MakeFile(_L("\\LONGNAMETEST\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04"));
|
sl@0
|
1776 |
r=gFileMan->Rename(_L("\\LONGNAMETEST"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
|
sl@0
|
1777 |
test(r==KErrNone);
|
sl@0
|
1778 |
}
|
sl@0
|
1779 |
|
sl@0
|
1780 |
//testing invalid source path at the beginning:
|
sl@0
|
1781 |
if (!gAsynch)
|
sl@0
|
1782 |
{
|
sl@0
|
1783 |
r=gFileMan->RmDir(_L(":C:\\F32-TST\\TFMAN\\RMDIR\\*.AT"));
|
sl@0
|
1784 |
}
|
sl@0
|
1785 |
else
|
sl@0
|
1786 |
{
|
sl@0
|
1787 |
r=gFileMan->RmDir(_L(":C:\\F32-TST\\TFMAN\\RMDIR\\*.AT"),gStat);
|
sl@0
|
1788 |
}
|
sl@0
|
1789 |
TestResult(r,KErrBadName,KErrBadName);
|
sl@0
|
1790 |
|
sl@0
|
1791 |
//testing invalid source path at the middle:
|
sl@0
|
1792 |
if (!gAsynch)
|
sl@0
|
1793 |
{
|
sl@0
|
1794 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\:RMDIR\\*.AT"));
|
sl@0
|
1795 |
}
|
sl@0
|
1796 |
else
|
sl@0
|
1797 |
{
|
sl@0
|
1798 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\:RMDIR\\*.AT"),gStat);
|
sl@0
|
1799 |
}
|
sl@0
|
1800 |
TestResult(r,KErrBadName,KErrNone);
|
sl@0
|
1801 |
|
sl@0
|
1802 |
//testing invalid source path at the end:
|
sl@0
|
1803 |
if (!gAsynch)
|
sl@0
|
1804 |
{
|
sl@0
|
1805 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\TESTDIR\\:DEF.txt"));
|
sl@0
|
1806 |
}
|
sl@0
|
1807 |
else
|
sl@0
|
1808 |
{
|
sl@0
|
1809 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\TESTDIR\\:DEF.txt"),gStat);
|
sl@0
|
1810 |
}
|
sl@0
|
1811 |
TestResult(r,KErrNone,KErrNone);
|
sl@0
|
1812 |
|
sl@0
|
1813 |
if (!gAsynch)
|
sl@0
|
1814 |
{
|
sl@0
|
1815 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\RMDIR\\*.AT"));
|
sl@0
|
1816 |
test(r==KErrNone);
|
sl@0
|
1817 |
if (testingInvalidPathLengths)
|
sl@0
|
1818 |
{
|
sl@0
|
1819 |
r=gFileMan->RmDir(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\"));
|
sl@0
|
1820 |
test(r==KErrNone);
|
sl@0
|
1821 |
}
|
sl@0
|
1822 |
}
|
sl@0
|
1823 |
else
|
sl@0
|
1824 |
{
|
sl@0
|
1825 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\RMDIR\\*.AT"),gStat);
|
sl@0
|
1826 |
test(r==KErrNone);
|
sl@0
|
1827 |
WaitForSuccess();
|
sl@0
|
1828 |
if (testingInvalidPathLengths)
|
sl@0
|
1829 |
{
|
sl@0
|
1830 |
r=gFileMan->RmDir(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\"),gStat);
|
sl@0
|
1831 |
test(r==KErrNone);
|
sl@0
|
1832 |
WaitForSuccess();
|
sl@0
|
1833 |
}
|
sl@0
|
1834 |
}
|
sl@0
|
1835 |
|
sl@0
|
1836 |
TEntry entry;
|
sl@0
|
1837 |
r=TheFs.Entry(_L("\\F32-TST\\TFMAN\\RMDIR"),entry);
|
sl@0
|
1838 |
test(r==KErrNotFound);
|
sl@0
|
1839 |
|
sl@0
|
1840 |
MakeDir(_L("\\F32-TST\\TFMAN\\READONLY\\"));
|
sl@0
|
1841 |
r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\READONLY\\"),KEntryAttReadOnly,0);
|
sl@0
|
1842 |
test(r==KErrNone);
|
sl@0
|
1843 |
|
sl@0
|
1844 |
if (!gAsynch)
|
sl@0
|
1845 |
{
|
sl@0
|
1846 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\"));
|
sl@0
|
1847 |
test(r==KErrAccessDenied);
|
sl@0
|
1848 |
}
|
sl@0
|
1849 |
else
|
sl@0
|
1850 |
{
|
sl@0
|
1851 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\"),gStat);
|
sl@0
|
1852 |
test(r==KErrNone);
|
sl@0
|
1853 |
WaitForResult(KErrAccessDenied);
|
sl@0
|
1854 |
}
|
sl@0
|
1855 |
|
sl@0
|
1856 |
r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\READONLY\\"),0,KEntryAttReadOnly);
|
sl@0
|
1857 |
test(r==KErrNone);
|
sl@0
|
1858 |
|
sl@0
|
1859 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\"));
|
sl@0
|
1860 |
test(r==KErrNone);
|
sl@0
|
1861 |
|
sl@0
|
1862 |
// Test behaviour for omitted parameters
|
sl@0
|
1863 |
// For this, default should be session path
|
sl@0
|
1864 |
TFileName sessionPath;
|
sl@0
|
1865 |
r=TheFs.SessionPath(sessionPath);
|
sl@0
|
1866 |
test(r==KErrNone);
|
sl@0
|
1867 |
|
sl@0
|
1868 |
SetupDirectories(ETrue, NULL);
|
sl@0
|
1869 |
r=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\"));
|
sl@0
|
1870 |
|
sl@0
|
1871 |
// Default removal of session path
|
sl@0
|
1872 |
r=gFileMan->RmDir(_L(""));
|
sl@0
|
1873 |
test(r==KErrNone);
|
sl@0
|
1874 |
|
sl@0
|
1875 |
r=TheFs.SetSessionPath(sessionPath);
|
sl@0
|
1876 |
|
sl@0
|
1877 |
r = gFileMan->Rename(_L("\\F32-TST\\TFMAN\\source\\subdir"), _L("\\F32-TST\\TFMAN\\source\\tofail"), CFileMan::ERecurse);
|
sl@0
|
1878 |
test(r == KErrPathNotFound);
|
sl@0
|
1879 |
|
sl@0
|
1880 |
r = gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\"));
|
sl@0
|
1881 |
test(r==KErrNone);
|
sl@0
|
1882 |
MakeDir(_L("\\F32-TST\\TFMAN\\"));
|
sl@0
|
1883 |
|
sl@0
|
1884 |
if(testingInvalidPathLengths)
|
sl@0
|
1885 |
{
|
sl@0
|
1886 |
TestINC091841(); // Test delete long fullnames
|
sl@0
|
1887 |
}
|
sl@0
|
1888 |
|
sl@0
|
1889 |
//---------------------------------------------
|
sl@0
|
1890 |
//! @SYMTestCaseID PBASE-T_FMAN-0316
|
sl@0
|
1891 |
//! @SYMTestType UT
|
sl@0
|
1892 |
//! @SYMREQ DEF099820
|
sl@0
|
1893 |
//! @SYMTestCaseDesc Test that CFileMan::RmDir() works when deleting a directory containing open files.
|
sl@0
|
1894 |
//! @SYMTestActions Open a file within a directory and try to remove the directory.
|
sl@0
|
1895 |
//! @SYMTestExpectedResults The operation completes with the error code KErrInUse.
|
sl@0
|
1896 |
//! @SYMTestPriority High
|
sl@0
|
1897 |
//! @SYMTestStatus Implemented
|
sl@0
|
1898 |
//---------------------------------------------
|
sl@0
|
1899 |
|
sl@0
|
1900 |
test.Next(_L("Test delete directory containing open files"));
|
sl@0
|
1901 |
gFileMan->SetObserver(NULL);
|
sl@0
|
1902 |
|
sl@0
|
1903 |
MakeDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"));
|
sl@0
|
1904 |
MakeFile(_L("\\F32-TST\\TFMAN\\OPENFILE\\FILE.TXT"));
|
sl@0
|
1905 |
|
sl@0
|
1906 |
RFile file;
|
sl@0
|
1907 |
r = file.Open(TheFs,_L("\\F32-TST\\TFMAN\\OPENFILE\\FILE.TXT"), EFileRead | EFileShareExclusive);
|
sl@0
|
1908 |
test(r==KErrNone);
|
sl@0
|
1909 |
|
sl@0
|
1910 |
if (!gAsynch)
|
sl@0
|
1911 |
{
|
sl@0
|
1912 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"));
|
sl@0
|
1913 |
test(r==KErrInUse);
|
sl@0
|
1914 |
|
sl@0
|
1915 |
file.Close();
|
sl@0
|
1916 |
|
sl@0
|
1917 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"));
|
sl@0
|
1918 |
test(r==KErrNone);
|
sl@0
|
1919 |
}
|
sl@0
|
1920 |
else
|
sl@0
|
1921 |
{
|
sl@0
|
1922 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"), gStat);
|
sl@0
|
1923 |
test(r==KErrNone);
|
sl@0
|
1924 |
WaitForResult(KErrInUse);
|
sl@0
|
1925 |
|
sl@0
|
1926 |
file.Close();
|
sl@0
|
1927 |
|
sl@0
|
1928 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"), gStat);
|
sl@0
|
1929 |
test(r==KErrNone);
|
sl@0
|
1930 |
WaitForResult(KErrNone);
|
sl@0
|
1931 |
}
|
sl@0
|
1932 |
|
sl@0
|
1933 |
gFileMan->SetObserver(gObserver);
|
sl@0
|
1934 |
}
|
sl@0
|
1935 |
|
sl@0
|
1936 |
LOCAL_C void TestRecursiveCopy()
|
sl@0
|
1937 |
//
|
sl@0
|
1938 |
// Test the recursive copy function
|
sl@0
|
1939 |
//
|
sl@0
|
1940 |
{
|
sl@0
|
1941 |
test.Next(_L("Test recursive copy"));
|
sl@0
|
1942 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
1943 |
|
sl@0
|
1944 |
MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
1945 |
MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\"));
|
sl@0
|
1946 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
|
sl@0
|
1947 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT"));
|
sl@0
|
1948 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE3.TXT"));
|
sl@0
|
1949 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\FILE4.TXT"));
|
sl@0
|
1950 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EXE1.BIN"));
|
sl@0
|
1951 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\EXE2.BIN"));
|
sl@0
|
1952 |
|
sl@0
|
1953 |
TInt r;
|
sl@0
|
1954 |
if (!gAsynch)
|
sl@0
|
1955 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\"),_L("\\F32-TST\\TFMAN\\COPYDIR"),CFileMan::ERecurse);
|
sl@0
|
1956 |
else
|
sl@0
|
1957 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\"),_L("\\F32-TST\\TFMAN\\COPYDIR"),CFileMan::ERecurse,gStat);
|
sl@0
|
1958 |
TestResult(r);
|
sl@0
|
1959 |
|
sl@0
|
1960 |
Compare(_L("\\F32-TST\\TFMAN\\DELDIR\\*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*"));
|
sl@0
|
1961 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
1962 |
MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
1963 |
|
sl@0
|
1964 |
if (!gAsynch)
|
sl@0
|
1965 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.BIN"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*.EXT"),CFileMan::ERecurse);
|
sl@0
|
1966 |
else
|
sl@0
|
1967 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.BIN"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*.EXT"),CFileMan::ERecurse,gStat);
|
sl@0
|
1968 |
TestResult(KErrNone);
|
sl@0
|
1969 |
|
sl@0
|
1970 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\"));
|
sl@0
|
1971 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELTEST\\EXE1.EXT"));
|
sl@0
|
1972 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\EXE2.EXT"));
|
sl@0
|
1973 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*"));
|
sl@0
|
1974 |
|
sl@0
|
1975 |
// Test behaviour for omitted parameters
|
sl@0
|
1976 |
// For this, default should be session path
|
sl@0
|
1977 |
TFileName sessionPath;
|
sl@0
|
1978 |
r=TheFs.SessionPath(sessionPath);
|
sl@0
|
1979 |
test(r==KErrNone);
|
sl@0
|
1980 |
|
sl@0
|
1981 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
1982 |
MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
1983 |
r=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
1984 |
|
sl@0
|
1985 |
// Default copy to session path
|
sl@0
|
1986 |
if (!gAsynch)
|
sl@0
|
1987 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\"),_L(""),CFileMan::ERecurse);
|
sl@0
|
1988 |
else
|
sl@0
|
1989 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\"),_L(""),CFileMan::ERecurse,gStat);
|
sl@0
|
1990 |
TestResult(KErrNone);
|
sl@0
|
1991 |
Compare(_L("\\F32-TST\\TFMAN\\DELDIR\\*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*"));
|
sl@0
|
1992 |
|
sl@0
|
1993 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
1994 |
MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
1995 |
r=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\DELDIR\\"));
|
sl@0
|
1996 |
|
sl@0
|
1997 |
// Default copy from session path
|
sl@0
|
1998 |
if (!gAsynch)
|
sl@0
|
1999 |
r=gFileMan->Copy(_L(""),_L("\\F32-TST\\TFMAN\\COPYDIR\\"),CFileMan::ERecurse);
|
sl@0
|
2000 |
else
|
sl@0
|
2001 |
r=gFileMan->Copy(_L(""),_L("\\F32-TST\\TFMAN\\COPYDIR\\"),CFileMan::ERecurse,gStat);
|
sl@0
|
2002 |
TestResult(KErrNone);
|
sl@0
|
2003 |
Compare(_L("\\F32-TST\\TFMAN\\DELDIR\\*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*"));
|
sl@0
|
2004 |
|
sl@0
|
2005 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
2006 |
RmDir(_L("\\F32-TST\\TFMAN\\DELDIR\\"));
|
sl@0
|
2007 |
r=TheFs.SetSessionPath(sessionPath);
|
sl@0
|
2008 |
test(r==KErrNone);
|
sl@0
|
2009 |
}
|
sl@0
|
2010 |
|
sl@0
|
2011 |
LOCAL_C void TestRecursiveAttribs()
|
sl@0
|
2012 |
//
|
sl@0
|
2013 |
// Test set attribs recursively
|
sl@0
|
2014 |
//
|
sl@0
|
2015 |
{
|
sl@0
|
2016 |
test.Next(_L("Test recursive attribs"));
|
sl@0
|
2017 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\Attrib1.AT"));
|
sl@0
|
2018 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\Attrib2.at"));
|
sl@0
|
2019 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\SUBDIR\\ATFILE.TXT"));
|
sl@0
|
2020 |
|
sl@0
|
2021 |
if (!gAsynch)
|
sl@0
|
2022 |
{
|
sl@0
|
2023 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),KEntryAttReadOnly,0,TTime(0),CFileMan::ERecurse);
|
sl@0
|
2024 |
test(r==KErrNone);
|
sl@0
|
2025 |
}
|
sl@0
|
2026 |
else
|
sl@0
|
2027 |
{
|
sl@0
|
2028 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),KEntryAttReadOnly,0,TTime(0),CFileMan::ERecurse,gStat);
|
sl@0
|
2029 |
test(r==KErrNone);
|
sl@0
|
2030 |
WaitForSuccess();
|
sl@0
|
2031 |
}
|
sl@0
|
2032 |
|
sl@0
|
2033 |
CDir* entryList;
|
sl@0
|
2034 |
CDirScan* scan=CDirScan::NewL(TheFs);
|
sl@0
|
2035 |
scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\*"),KEntryAttMaskSupported,ESortByName);
|
sl@0
|
2036 |
scan->NextL(entryList);
|
sl@0
|
2037 |
TInt count=entryList->Count();
|
sl@0
|
2038 |
test(count==3);
|
sl@0
|
2039 |
TEntry entry=(*entryList)[0];
|
sl@0
|
2040 |
test(entry.iName.MatchF(_L("ATTRIB1.AT"))!=KErrNotFound);
|
sl@0
|
2041 |
if (!IsTestingLFFS())
|
sl@0
|
2042 |
test(entry.iAtt==(KEntryAttReadOnly|KEntryAttArchive));
|
sl@0
|
2043 |
else
|
sl@0
|
2044 |
test(entry.iAtt&KEntryAttReadOnly); // ???
|
sl@0
|
2045 |
entry=(*entryList)[1];
|
sl@0
|
2046 |
test(entry.iName.MatchF(_L("ATTRIB2.AT"))!=KErrNotFound);
|
sl@0
|
2047 |
if (!IsTestingLFFS())
|
sl@0
|
2048 |
test(entry.iAtt==(KEntryAttReadOnly|KEntryAttArchive));
|
sl@0
|
2049 |
else
|
sl@0
|
2050 |
test(entry.iAtt&KEntryAttReadOnly); // ???
|
sl@0
|
2051 |
entry=(*entryList)[2];
|
sl@0
|
2052 |
test(entry.iName.MatchF(_L("SUBDIR"))!=KErrNotFound);
|
sl@0
|
2053 |
delete entryList;
|
sl@0
|
2054 |
|
sl@0
|
2055 |
scan->NextL(entryList);
|
sl@0
|
2056 |
count=entryList->Count();
|
sl@0
|
2057 |
test(count==1);
|
sl@0
|
2058 |
entry=(*entryList)[0];
|
sl@0
|
2059 |
test(entry.iName.MatchF(_L("ATFILE.TXT"))!=KErrNotFound);
|
sl@0
|
2060 |
if (!IsTestingLFFS())
|
sl@0
|
2061 |
test(entry.iAtt==(KEntryAttReadOnly|KEntryAttArchive));
|
sl@0
|
2062 |
else
|
sl@0
|
2063 |
test(entry.iAtt&KEntryAttReadOnly); // ???
|
sl@0
|
2064 |
delete entryList;
|
sl@0
|
2065 |
|
sl@0
|
2066 |
scan->NextL(entryList);
|
sl@0
|
2067 |
test(entryList==NULL);
|
sl@0
|
2068 |
|
sl@0
|
2069 |
if (!gAsynch)
|
sl@0
|
2070 |
{
|
sl@0
|
2071 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),0,KEntryAttReadOnly|KEntryAttArchive,TTime(0),CFileMan::ERecurse);
|
sl@0
|
2072 |
test(r==KErrNone);
|
sl@0
|
2073 |
}
|
sl@0
|
2074 |
else
|
sl@0
|
2075 |
{
|
sl@0
|
2076 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),0,KEntryAttReadOnly|KEntryAttArchive,TTime(0),CFileMan::ERecurse,gStat);
|
sl@0
|
2077 |
test(r==KErrNone);
|
sl@0
|
2078 |
WaitForSuccess();
|
sl@0
|
2079 |
}
|
sl@0
|
2080 |
|
sl@0
|
2081 |
scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\*"),KEntryAttMaskSupported,ESortByName);
|
sl@0
|
2082 |
scan->NextL(entryList);
|
sl@0
|
2083 |
count=entryList->Count();
|
sl@0
|
2084 |
test(count==3);
|
sl@0
|
2085 |
entry=(*entryList)[0];
|
sl@0
|
2086 |
test(entry.iName.MatchF(_L("ATTRIB1.AT"))!=KErrNotFound);
|
sl@0
|
2087 |
test(entry.iAtt==KEntryAttNormal);
|
sl@0
|
2088 |
entry=(*entryList)[1];
|
sl@0
|
2089 |
test(entry.iName.MatchF(_L("ATTRIB2.AT"))!=KErrNotFound);
|
sl@0
|
2090 |
test(entry.iAtt==KEntryAttNormal);
|
sl@0
|
2091 |
entry=(*entryList)[2];
|
sl@0
|
2092 |
test(entry.iName.MatchF(_L("SUBDIR"))!=KErrNotFound);
|
sl@0
|
2093 |
delete entryList;
|
sl@0
|
2094 |
|
sl@0
|
2095 |
scan->NextL(entryList);
|
sl@0
|
2096 |
count=entryList->Count();
|
sl@0
|
2097 |
test(count==1);
|
sl@0
|
2098 |
entry=(*entryList)[0];
|
sl@0
|
2099 |
test(entry.iName.MatchF(_L("ATFILE.TXT"))!=KErrNotFound);
|
sl@0
|
2100 |
test(entry.iAtt==KEntryAttNormal);
|
sl@0
|
2101 |
delete entryList;
|
sl@0
|
2102 |
|
sl@0
|
2103 |
scan->NextL(entryList);
|
sl@0
|
2104 |
test(entryList==NULL);
|
sl@0
|
2105 |
delete scan;
|
sl@0
|
2106 |
}
|
sl@0
|
2107 |
|
sl@0
|
2108 |
LOCAL_C void TestRecursiveDelete()
|
sl@0
|
2109 |
//
|
sl@0
|
2110 |
// Test Recursive delete
|
sl@0
|
2111 |
//
|
sl@0
|
2112 |
{
|
sl@0
|
2113 |
test.Next(_L("Test recursive delete"));
|
sl@0
|
2114 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FULL\\GRAPE.TXT"));
|
sl@0
|
2115 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FULL\\GRAPE.PLP"));
|
sl@0
|
2116 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\GRAPE.PLP"));
|
sl@0
|
2117 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FILE1.TXT"));
|
sl@0
|
2118 |
|
sl@0
|
2119 |
if (!gAsynch)
|
sl@0
|
2120 |
{
|
sl@0
|
2121 |
TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\RECDELETE\\*.PLP"),CFileMan::ERecurse);
|
sl@0
|
2122 |
test(r==KErrNone);
|
sl@0
|
2123 |
}
|
sl@0
|
2124 |
else
|
sl@0
|
2125 |
{
|
sl@0
|
2126 |
TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\RECDELETE\\*.PLP"),CFileMan::ERecurse,gStat);
|
sl@0
|
2127 |
test(r==KErrNone);
|
sl@0
|
2128 |
WaitForSuccess();
|
sl@0
|
2129 |
}
|
sl@0
|
2130 |
|
sl@0
|
2131 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\"));
|
sl@0
|
2132 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FULL\\GRAPE.TXT"));
|
sl@0
|
2133 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE1.TXT"));
|
sl@0
|
2134 |
Compare(_L("\\F32-TST\\TFMAN\\after\\*"),_L("\\F32-TST\\TFMAN\\RecDelete\\*"));
|
sl@0
|
2135 |
}
|
sl@0
|
2136 |
|
sl@0
|
2137 |
LOCAL_C void TestINC108401()
|
sl@0
|
2138 |
{
|
sl@0
|
2139 |
|
sl@0
|
2140 |
test.Next(_L("Test synchronous and asynchronous move operations (INC108401)"));
|
sl@0
|
2141 |
TInt err = 0;
|
sl@0
|
2142 |
|
sl@0
|
2143 |
TFileName trgPath = _L("?:\\F32-TST\\");
|
sl@0
|
2144 |
|
sl@0
|
2145 |
if (gSessionPath[0]!='D'&& gSessionPath[0]!='Y')
|
sl@0
|
2146 |
{
|
sl@0
|
2147 |
#if !defined(__WINS__)
|
sl@0
|
2148 |
trgPath[0] = 'D';
|
sl@0
|
2149 |
#else
|
sl@0
|
2150 |
trgPath[0] = 'Y';
|
sl@0
|
2151 |
#endif
|
sl@0
|
2152 |
}
|
sl@0
|
2153 |
else
|
sl@0
|
2154 |
return;
|
sl@0
|
2155 |
|
sl@0
|
2156 |
TFileName trgDir = trgPath;
|
sl@0
|
2157 |
trgDir.Append(_L("TFMAN\\INC108401\\dest\\"));
|
sl@0
|
2158 |
|
sl@0
|
2159 |
// Moving files and dirs ACROSS DRIVE.
|
sl@0
|
2160 |
err = 0;
|
sl@0
|
2161 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\"));
|
sl@0
|
2162 |
MakeDir(trgDir);
|
sl@0
|
2163 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file1"));
|
sl@0
|
2164 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file2"));
|
sl@0
|
2165 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"));
|
sl@0
|
2166 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"));
|
sl@0
|
2167 |
// Synchronously
|
sl@0
|
2168 |
if (!gAsynch)
|
sl@0
|
2169 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), trgDir, 0);
|
sl@0
|
2170 |
else // Asynchronously
|
sl@0
|
2171 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), trgDir, 0, gStat);
|
sl@0
|
2172 |
test.Next(_L("Test INC108401 : ACROSS DRIVES with 0"));
|
sl@0
|
2173 |
TestResult(err);
|
sl@0
|
2174 |
// cleanup the current drive
|
sl@0
|
2175 |
RmDir(trgPath);
|
sl@0
|
2176 |
// remove the F32-TST dir on the C: drive
|
sl@0
|
2177 |
RmDir(_L("\\F32-TST\\TFMAN\\"));
|
sl@0
|
2178 |
|
sl@0
|
2179 |
err = 0;
|
sl@0
|
2180 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\"));
|
sl@0
|
2181 |
MakeDir(trgDir);
|
sl@0
|
2182 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file1"));
|
sl@0
|
2183 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file2"));
|
sl@0
|
2184 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"));
|
sl@0
|
2185 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"));
|
sl@0
|
2186 |
// Synchronously
|
sl@0
|
2187 |
if (!gAsynch)
|
sl@0
|
2188 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), trgDir, CFileMan::EOverWrite);
|
sl@0
|
2189 |
else // Asynchronously
|
sl@0
|
2190 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), trgDir, CFileMan::EOverWrite, gStat);
|
sl@0
|
2191 |
test.Next(_L("Test INC108401 : ACROSS DRIVES with CFileMan::EOverWrite"));
|
sl@0
|
2192 |
TestResult(err);
|
sl@0
|
2193 |
// cleanup the current drive
|
sl@0
|
2194 |
RmDir(trgPath);
|
sl@0
|
2195 |
// remove the F32-TST dir on the C: drive
|
sl@0
|
2196 |
RmDir(_L("\\F32-TST\\"));
|
sl@0
|
2197 |
|
sl@0
|
2198 |
err = 0;
|
sl@0
|
2199 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\"));
|
sl@0
|
2200 |
MakeDir(trgDir);
|
sl@0
|
2201 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file1"));
|
sl@0
|
2202 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file2"));
|
sl@0
|
2203 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"));
|
sl@0
|
2204 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"));
|
sl@0
|
2205 |
// Synchronously
|
sl@0
|
2206 |
if (!gAsynch)
|
sl@0
|
2207 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), trgDir, CFileMan::ERecurse);
|
sl@0
|
2208 |
else // Asynchronously
|
sl@0
|
2209 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), trgDir, CFileMan::ERecurse, gStat);
|
sl@0
|
2210 |
test.Next(_L("Test INC108401 : ACROSS DRIVES with CFileMan::ERecurse"));
|
sl@0
|
2211 |
TestResult(err);
|
sl@0
|
2212 |
// cleanup the current drive
|
sl@0
|
2213 |
RmDir(trgPath);
|
sl@0
|
2214 |
// remove the F32-TST dir on the C: drive
|
sl@0
|
2215 |
RmDir(_L("\\F32-TST\\"));
|
sl@0
|
2216 |
|
sl@0
|
2217 |
|
sl@0
|
2218 |
// Moving files and dirs on the SAME DRIVE.
|
sl@0
|
2219 |
// case for gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), 0);
|
sl@0
|
2220 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\"));
|
sl@0
|
2221 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\dest\\"));
|
sl@0
|
2222 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file1"));
|
sl@0
|
2223 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file2"));
|
sl@0
|
2224 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"));
|
sl@0
|
2225 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"));
|
sl@0
|
2226 |
// Synchronously
|
sl@0
|
2227 |
if (!gAsynch)
|
sl@0
|
2228 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), 0);
|
sl@0
|
2229 |
else // Asynchronously
|
sl@0
|
2230 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), 0, gStat);
|
sl@0
|
2231 |
test.Next(_L("Test INC108401 : SAME DRIVE with 0"));
|
sl@0
|
2232 |
TestResult(err);
|
sl@0
|
2233 |
// test(err==KErrNone);
|
sl@0
|
2234 |
RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\"));
|
sl@0
|
2235 |
|
sl@0
|
2236 |
// case for gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite);
|
sl@0
|
2237 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\"));
|
sl@0
|
2238 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\dest\\"));
|
sl@0
|
2239 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file1"));
|
sl@0
|
2240 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file2"));
|
sl@0
|
2241 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"));
|
sl@0
|
2242 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"));
|
sl@0
|
2243 |
// Synchronously
|
sl@0
|
2244 |
if (!gAsynch)
|
sl@0
|
2245 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite);
|
sl@0
|
2246 |
else // Asynchronously
|
sl@0
|
2247 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite, gStat);
|
sl@0
|
2248 |
test.Next(_L("Test INC108401 : SAME DRIVE with CFileMan::EOverWrite"));
|
sl@0
|
2249 |
TestResult(err);
|
sl@0
|
2250 |
// test(err==KErrNone);
|
sl@0
|
2251 |
RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\"));
|
sl@0
|
2252 |
|
sl@0
|
2253 |
// case for gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite|CFileMan::ERecurse);
|
sl@0
|
2254 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\"));
|
sl@0
|
2255 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\dest\\"));
|
sl@0
|
2256 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file1"));
|
sl@0
|
2257 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file2"));
|
sl@0
|
2258 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"));
|
sl@0
|
2259 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"));
|
sl@0
|
2260 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\file1"));
|
sl@0
|
2261 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\file1"));
|
sl@0
|
2262 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\file1"));
|
sl@0
|
2263 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\file1"));
|
sl@0
|
2264 |
// Synchronously
|
sl@0
|
2265 |
if (!gAsynch)
|
sl@0
|
2266 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::ERecurse|CFileMan::EOverWrite);
|
sl@0
|
2267 |
else // Asynchronously
|
sl@0
|
2268 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::ERecurse|CFileMan::EOverWrite, gStat);
|
sl@0
|
2269 |
test.Next(_L("Test INC108401 : SAME DRIVES with CFileMan::ERecurse|CFileMan::EOverWrite"));
|
sl@0
|
2270 |
TestResult(err);
|
sl@0
|
2271 |
// test(err==KErrNone);
|
sl@0
|
2272 |
RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\"));
|
sl@0
|
2273 |
|
sl@0
|
2274 |
// cleanup for the current drive
|
sl@0
|
2275 |
RmDir(trgPath);
|
sl@0
|
2276 |
RmDir(_L("\\F32-TST\\"));
|
sl@0
|
2277 |
|
sl@0
|
2278 |
test.Printf(_L("Test INC108401 : ends\n"));
|
sl@0
|
2279 |
}
|
sl@0
|
2280 |
|
sl@0
|
2281 |
LOCAL_C void TestINC089638()
|
sl@0
|
2282 |
{
|
sl@0
|
2283 |
if(gAsynch)
|
sl@0
|
2284 |
{
|
sl@0
|
2285 |
return;
|
sl@0
|
2286 |
}
|
sl@0
|
2287 |
|
sl@0
|
2288 |
test.Next(_L("Test all items removed from source directory after recursive moving (INC089638)"));
|
sl@0
|
2289 |
RmDir(_L("\\INC089638\\source\\"));
|
sl@0
|
2290 |
RmDir(_L("\\INC089638\\dest\\"));
|
sl@0
|
2291 |
MakeFile(_L("\\INC089638\\source\\file1"));
|
sl@0
|
2292 |
MakeFile(_L("\\INC089638\\source\\file2"));
|
sl@0
|
2293 |
MakeFile(_L("\\INC089638\\source\\subdir1\\file3"));
|
sl@0
|
2294 |
MakeFile(_L("\\INC089638\\source\\subdir1\\file4"));
|
sl@0
|
2295 |
MakeFile(_L("\\INC089638\\source\\subdir2\\file5"));
|
sl@0
|
2296 |
MakeFile(_L("\\INC089638\\source\\subdir2\\file6"));
|
sl@0
|
2297 |
MakeDir(_L("\\INC089638\\dest\\"));
|
sl@0
|
2298 |
test(TheFs.SetAtt(_L("\\INC089638\\source\\subdir1"), KEntryAttHidden, 0) == KErrNone);
|
sl@0
|
2299 |
test(TheFs.SetAtt(_L("\\INC089638\\source\\subdir2"), KEntryAttReadOnly, 0) == KErrNone);
|
sl@0
|
2300 |
|
sl@0
|
2301 |
TInt r = gFileMan->Move(_L("\\INC089638\\source\\"), _L("\\INC089638\\dest\\"), CFileMan::ERecurse);
|
sl@0
|
2302 |
test(r==KErrNone);
|
sl@0
|
2303 |
r = TheFs.RmDir(_L("\\INC089638\\source\\"));
|
sl@0
|
2304 |
test(r==KErrNone);
|
sl@0
|
2305 |
|
sl@0
|
2306 |
RmDir(_L("\\INC089638\\"));
|
sl@0
|
2307 |
}
|
sl@0
|
2308 |
|
sl@0
|
2309 |
void TestINC101379()
|
sl@0
|
2310 |
{
|
sl@0
|
2311 |
test.Next(_L("Test moving of directory to its subdirectory recursively and not recursively (INC101379)"));
|
sl@0
|
2312 |
TInt err;
|
sl@0
|
2313 |
_LIT(KSourceDir,"\\INC101379\\dir\\");
|
sl@0
|
2314 |
_LIT(KFile1, "\\INC101379\\dir\\file1.txt");
|
sl@0
|
2315 |
_LIT(KFile2, "\\INC101379\\dir\\subdir\\file2.txt");
|
sl@0
|
2316 |
_LIT(KFile3, "\\INC101379\\dir\\other\\file3.txt");
|
sl@0
|
2317 |
MakeFile(KFile1, _L8("qwerty"));
|
sl@0
|
2318 |
MakeFile(KFile2, _L8("abc"));
|
sl@0
|
2319 |
MakeFile(KFile3, _L8("qwerty"));
|
sl@0
|
2320 |
TFileName dest;
|
sl@0
|
2321 |
dest.Copy(KSourceDir);
|
sl@0
|
2322 |
dest.Append(_L("subdir"));
|
sl@0
|
2323 |
gFileMan->SetObserver(NULL);
|
sl@0
|
2324 |
if (!gAsynch)
|
sl@0
|
2325 |
err = gFileMan->Move(KSourceDir, dest, CFileMan::ERecurse|CFileMan::EOverWrite);
|
sl@0
|
2326 |
else
|
sl@0
|
2327 |
err = gFileMan->Move(KSourceDir, dest, CFileMan::ERecurse|CFileMan::EOverWrite, gStat);
|
sl@0
|
2328 |
test(err==KErrInUse); // Recursive move prohibited
|
sl@0
|
2329 |
if (gAsynch)
|
sl@0
|
2330 |
WaitForResult(KErrInUse);
|
sl@0
|
2331 |
CheckFileContents(KFile1, _L8("qwerty"));
|
sl@0
|
2332 |
CheckFileContents(KFile2, _L8("abc"));
|
sl@0
|
2333 |
CheckFileContents(KFile3, _L8("qwerty"));
|
sl@0
|
2334 |
|
sl@0
|
2335 |
if (!gAsynch)
|
sl@0
|
2336 |
err = gFileMan->Move(KSourceDir, dest, CFileMan::EOverWrite);
|
sl@0
|
2337 |
else
|
sl@0
|
2338 |
err = gFileMan->Move(KSourceDir, dest, CFileMan::EOverWrite, gStat);
|
sl@0
|
2339 |
TestResult(err, KErrNone); // Non-recursive move must be OK
|
sl@0
|
2340 |
|
sl@0
|
2341 |
_LIT(KFile1Moved, "\\INC101379\\dir\\subdir\\file1.txt");
|
sl@0
|
2342 |
CheckFileContents(KFile1Moved, _L8("qwerty"));
|
sl@0
|
2343 |
CheckFileContents(KFile2, _L8("abc"));
|
sl@0
|
2344 |
CheckFileContents(KFile3, _L8("qwerty"));
|
sl@0
|
2345 |
gFileMan->SetObserver(gObserver);
|
sl@0
|
2346 |
RmDir(KSourceDir);
|
sl@0
|
2347 |
RmDir(_L("\\INC101379\\"));
|
sl@0
|
2348 |
}
|
sl@0
|
2349 |
|
sl@0
|
2350 |
void TestINC099600() // and INC101061
|
sl@0
|
2351 |
{
|
sl@0
|
2352 |
// Test move files from the internal drive to an external one (INC099600)
|
sl@0
|
2353 |
// Test move files with system (KEntryAttSystem) or hidden (KEntryAttHidden) attributes (INC101061)
|
sl@0
|
2354 |
test.Next(_L("Test move files from internal drive to external with system and hidden attributes"));
|
sl@0
|
2355 |
_LIT(KDest,"C:\\DEST099600\\");
|
sl@0
|
2356 |
TBuf<64> source;
|
sl@0
|
2357 |
source.Format(_L("%c:\\INC099600\\"), (TUint) gDriveToTest);
|
sl@0
|
2358 |
TBuf<64> src;
|
sl@0
|
2359 |
TInt r;
|
sl@0
|
2360 |
TBuf<64> dst;
|
sl@0
|
2361 |
RmDir(source);
|
sl@0
|
2362 |
RmDir(KDest);
|
sl@0
|
2363 |
|
sl@0
|
2364 |
src = source;
|
sl@0
|
2365 |
src.Append('a');
|
sl@0
|
2366 |
MakeFile(src);
|
sl@0
|
2367 |
TheFs.SetAtt(src, KEntryAttArchive, 0);
|
sl@0
|
2368 |
src.Append('h');
|
sl@0
|
2369 |
MakeFile(src);
|
sl@0
|
2370 |
TheFs.SetAtt(src, KEntryAttArchive | KEntryAttHidden, 0);
|
sl@0
|
2371 |
src.Append('s');
|
sl@0
|
2372 |
MakeFile(src);
|
sl@0
|
2373 |
TheFs.SetAtt(src, KEntryAttArchive | KEntryAttHidden | KEntryAttSystem, 0);
|
sl@0
|
2374 |
src.Append('x');
|
sl@0
|
2375 |
src.Append(KPathDelimiter);
|
sl@0
|
2376 |
src.Append('a');
|
sl@0
|
2377 |
MakeFile(src);
|
sl@0
|
2378 |
TheFs.SetAtt(src, KEntryAttArchive, 0);
|
sl@0
|
2379 |
src.Append('h');
|
sl@0
|
2380 |
MakeFile(src);
|
sl@0
|
2381 |
TheFs.SetAtt(src, KEntryAttArchive | KEntryAttHidden, 0);
|
sl@0
|
2382 |
|
sl@0
|
2383 |
dst.Copy(KDest);
|
sl@0
|
2384 |
dst.Append(_L("ahsx\\"));
|
sl@0
|
2385 |
MakeDir(dst);
|
sl@0
|
2386 |
|
sl@0
|
2387 |
TEntry entry;
|
sl@0
|
2388 |
r = gFileMan->Move(src, KDest, 0); // ahsx\ah
|
sl@0
|
2389 |
test(r == KErrNone);
|
sl@0
|
2390 |
r = TheFs.Entry(src, entry);
|
sl@0
|
2391 |
test(r == KErrNotFound);
|
sl@0
|
2392 |
|
sl@0
|
2393 |
src.SetLength(src.Length()-1); // ahsx\a
|
sl@0
|
2394 |
r = gFileMan->Move(src, KDest, 0);
|
sl@0
|
2395 |
test(r == KErrNone);
|
sl@0
|
2396 |
r = TheFs.Entry(src, entry);
|
sl@0
|
2397 |
test(r == KErrNotFound);
|
sl@0
|
2398 |
|
sl@0
|
2399 |
src.SetLength(src.Length()-3); // ahs
|
sl@0
|
2400 |
r = gFileMan->Move(src, KDest, 0);
|
sl@0
|
2401 |
test(r == KErrNone);
|
sl@0
|
2402 |
r = TheFs.Entry(src, entry);
|
sl@0
|
2403 |
test(r == KErrNotFound);
|
sl@0
|
2404 |
|
sl@0
|
2405 |
src.SetLength(src.Length()-1); // ah
|
sl@0
|
2406 |
r = gFileMan->Move(src, KDest, 0);
|
sl@0
|
2407 |
test(r == KErrAlreadyExists);
|
sl@0
|
2408 |
r = TheFs.Entry(src, entry);
|
sl@0
|
2409 |
test(r == KErrNone);
|
sl@0
|
2410 |
|
sl@0
|
2411 |
r = gFileMan->Move(src, KDest, CFileMan::EOverWrite); // ah
|
sl@0
|
2412 |
test(r == KErrNone);
|
sl@0
|
2413 |
r = TheFs.Entry(src, entry);
|
sl@0
|
2414 |
test(r == KErrNotFound);
|
sl@0
|
2415 |
|
sl@0
|
2416 |
src.SetLength(src.Length()-1); // a
|
sl@0
|
2417 |
r = gFileMan->Move(src, KDest, 0);
|
sl@0
|
2418 |
test(r == KErrAlreadyExists);
|
sl@0
|
2419 |
r = TheFs.Entry(src, entry);
|
sl@0
|
2420 |
test(r == KErrNone);
|
sl@0
|
2421 |
|
sl@0
|
2422 |
r = gFileMan->Move(src, KDest, CFileMan::EOverWrite); // a
|
sl@0
|
2423 |
test(r == KErrNone);
|
sl@0
|
2424 |
r = TheFs.Entry(src, entry);
|
sl@0
|
2425 |
test(r == KErrNotFound);
|
sl@0
|
2426 |
|
sl@0
|
2427 |
RmDir(source);
|
sl@0
|
2428 |
RmDir(KDest);
|
sl@0
|
2429 |
}
|
sl@0
|
2430 |
|
sl@0
|
2431 |
void SetupDirectoriesForCase0520()
|
sl@0
|
2432 |
// Setup initial directory structure for test case PBASE-T_FMAN-0520
|
sl@0
|
2433 |
{
|
sl@0
|
2434 |
RmDir( _L("\\F32-TST\\TFMAN\\INC106735\\"));
|
sl@0
|
2435 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735\\"));
|
sl@0
|
2436 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735\\F_ROOT.TXT"), _L8("blahblahblah"));
|
sl@0
|
2437 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"));
|
sl@0
|
2438 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\F_SUB.TXT"), _L8("blahblahblah"));
|
sl@0
|
2439 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735\\SUB01\\"));
|
sl@0
|
2440 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735\\SUB01\\F_SUB01.TXT"), _L8("blahblahblah"));
|
sl@0
|
2441 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735\\SUB01\\SUB02\\"));
|
sl@0
|
2442 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735\\SUB01\\SUB02\\F_SUB02.TXT"), _L8("blahblahblah"));
|
sl@0
|
2443 |
}
|
sl@0
|
2444 |
|
sl@0
|
2445 |
void SetupDirectoriesForCase0520Compare1()
|
sl@0
|
2446 |
// Comparing directory structure for recursive Move() without wildcard
|
sl@0
|
2447 |
{
|
sl@0
|
2448 |
RmDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\"));
|
sl@0
|
2449 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\"));
|
sl@0
|
2450 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\"));
|
sl@0
|
2451 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_ROOT.TXT"), _L8("blahblahblah"));
|
sl@0
|
2452 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_SUB.TXT"), _L8("blahblahblah"));
|
sl@0
|
2453 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\"));
|
sl@0
|
2454 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\F_SUB01.TXT"), _L8("blahblahblah"));
|
sl@0
|
2455 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\"));
|
sl@0
|
2456 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\F_SUB02.TXT"), _L8("blahblahblah"));
|
sl@0
|
2457 |
}
|
sl@0
|
2458 |
|
sl@0
|
2459 |
void SetupDirectoriesForCase0520Compare2()
|
sl@0
|
2460 |
// Comparing directory structure for recursive Move() with wildcard
|
sl@0
|
2461 |
{
|
sl@0
|
2462 |
RmDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\"));
|
sl@0
|
2463 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\"));
|
sl@0
|
2464 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\"));
|
sl@0
|
2465 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_ROOT.TXT"), _L8("blahblahblah"));
|
sl@0
|
2466 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_SUB.TXT"), _L8("blahblahblah"));
|
sl@0
|
2467 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\SUB01\\F_SUB01.TXT"), _L8("blahblahblah"));
|
sl@0
|
2468 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\SUB01\\SUB02\\F_SUB02.TXT"), _L8("blahblahblah"));
|
sl@0
|
2469 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\"));
|
sl@0
|
2470 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\"));
|
sl@0
|
2471 |
}
|
sl@0
|
2472 |
|
sl@0
|
2473 |
void SetupDirectoriesForCase0520Compare3()
|
sl@0
|
2474 |
// Comparing directory structure for recursive Copy() without wildcard
|
sl@0
|
2475 |
{
|
sl@0
|
2476 |
RmDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\"));
|
sl@0
|
2477 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\"));
|
sl@0
|
2478 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\F_ROOT.TXT"), _L8("blahblahblah"));
|
sl@0
|
2479 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\"));
|
sl@0
|
2480 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_ROOT.TXT"), _L8("blahblahblah"));
|
sl@0
|
2481 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_SUB.TXT"), _L8("blahblahblah"));
|
sl@0
|
2482 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\"));
|
sl@0
|
2483 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\F_SUB01.TXT"), _L8("blahblahblah"));
|
sl@0
|
2484 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\"));
|
sl@0
|
2485 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\F_SUB02.TXT"), _L8("blahblahblah"));
|
sl@0
|
2486 |
}
|
sl@0
|
2487 |
|
sl@0
|
2488 |
void SetupDirectoriesForCase0520Compare4()
|
sl@0
|
2489 |
// Comparing directory structure for recursive Copy() with wildcard
|
sl@0
|
2490 |
{
|
sl@0
|
2491 |
RmDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\"));
|
sl@0
|
2492 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\"));
|
sl@0
|
2493 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\F_ROOT.TXT"), _L8("blahblahblah"));
|
sl@0
|
2494 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\"));
|
sl@0
|
2495 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_ROOT.TXT"), _L8("blahblahblah"));
|
sl@0
|
2496 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_SUB.TXT"), _L8("blahblahblah"));
|
sl@0
|
2497 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\SUB01\\F_SUB01.TXT"), _L8("blahblahblah"));
|
sl@0
|
2498 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\SUB01\\SUB02\\F_SUB02.TXT"), _L8("blahblahblah"));
|
sl@0
|
2499 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\"));
|
sl@0
|
2500 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\F_SUB01.TXT"), _L8("blahblahblah"));
|
sl@0
|
2501 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\"));
|
sl@0
|
2502 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\F_SUB02.TXT"), _L8("blahblahblah"));
|
sl@0
|
2503 |
}
|
sl@0
|
2504 |
|
sl@0
|
2505 |
LOCAL_C void TestRecursiveMove()
|
sl@0
|
2506 |
//
|
sl@0
|
2507 |
// Test recursive move
|
sl@0
|
2508 |
//
|
sl@0
|
2509 |
{
|
sl@0
|
2510 |
test.Next(_L("Test recursive move"));
|
sl@0
|
2511 |
RmDir(_L("\\F32-TST\\TFMAN\\RecMove2\\"));
|
sl@0
|
2512 |
|
sl@0
|
2513 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECMOVE\\FULL\\FILE2.PLP"));
|
sl@0
|
2514 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECMOVE\\FULL\\FILE3.PLP"));
|
sl@0
|
2515 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECMOVE\\FULL\\GRAPE.TXT"));
|
sl@0
|
2516 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECMOVE\\GRAPE.TXT"));
|
sl@0
|
2517 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECMOVE\\FILE1.PLP"));
|
sl@0
|
2518 |
|
sl@0
|
2519 |
TInt err;
|
sl@0
|
2520 |
if (!gAsynch)
|
sl@0
|
2521 |
err=gFileMan->Move(_L("\\F32-TST\\TFMAN\\RECMOVE\\*.PLP"),_L("\\F32-TST\\TFMAN\\RECMOVE2\\"),CFileMan::ERecurse);
|
sl@0
|
2522 |
else
|
sl@0
|
2523 |
err=gFileMan->Move(_L("\\F32-TST\\TFMAN\\RECMOVE\\*.PLP"),_L("\\F32-TST\\TFMAN\\RECMOVE2\\"),CFileMan::ERecurse,gStat);
|
sl@0
|
2524 |
TestResult(err);
|
sl@0
|
2525 |
|
sl@0
|
2526 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\"));
|
sl@0
|
2527 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FULL\\FILE2.PLP"));
|
sl@0
|
2528 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FULL\\FILE3.PLP"));
|
sl@0
|
2529 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE1.PLP"));
|
sl@0
|
2530 |
Compare(_L("\\F32-TST\\TFMAN\\after\\*"),_L("\\F32-TST\\TFMAN\\RecMOve2\\*"));
|
sl@0
|
2531 |
|
sl@0
|
2532 |
//
|
sl@0
|
2533 |
// Test moving empty directories (DEF073924)
|
sl@0
|
2534 |
//
|
sl@0
|
2535 |
test.Next(_L("Test moving empty directories"));
|
sl@0
|
2536 |
|
sl@0
|
2537 |
SetupDirectories(EFalse, NULL);
|
sl@0
|
2538 |
|
sl@0
|
2539 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse);
|
sl@0
|
2540 |
test(err == KErrNotFound); // Expected - directory is empty
|
sl@0
|
2541 |
|
sl@0
|
2542 |
// Test that all directories are still present
|
sl@0
|
2543 |
TEntry entry;
|
sl@0
|
2544 |
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry);
|
sl@0
|
2545 |
test(err == KErrNone);
|
sl@0
|
2546 |
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\dest\\"), entry);
|
sl@0
|
2547 |
test(err == KErrNone);
|
sl@0
|
2548 |
|
sl@0
|
2549 |
SetupDirectories(EFalse, NULL);
|
sl@0
|
2550 |
|
sl@0
|
2551 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse);
|
sl@0
|
2552 |
test(err == KErrNone); // Expected - should move (or rename) directory
|
sl@0
|
2553 |
|
sl@0
|
2554 |
// Test directory has been moved
|
sl@0
|
2555 |
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\dest\\source\\"), entry);
|
sl@0
|
2556 |
test(err == KErrNone);
|
sl@0
|
2557 |
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry);
|
sl@0
|
2558 |
test(err == KErrNotFound);
|
sl@0
|
2559 |
|
sl@0
|
2560 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\source\\"));
|
sl@0
|
2561 |
|
sl@0
|
2562 |
//
|
sl@0
|
2563 |
// Test moving when the source directory contains subdirectories (INC074828, INC078800)
|
sl@0
|
2564 |
//
|
sl@0
|
2565 |
test.Next(_L("Test moving a directory containing subdirectories"));
|
sl@0
|
2566 |
|
sl@0
|
2567 |
SetupDirectories(ETrue, NULL);
|
sl@0
|
2568 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse | CFileMan::EOverWrite);
|
sl@0
|
2569 |
test(err == KErrNone);
|
sl@0
|
2570 |
|
sl@0
|
2571 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*"));
|
sl@0
|
2572 |
|
sl@0
|
2573 |
//---------------------------------------------
|
sl@0
|
2574 |
//! @SYMTestCaseID PBASE-T_FMAN-0160
|
sl@0
|
2575 |
//! @SYMTestType UT
|
sl@0
|
2576 |
//! @SYMREQ DEF087791
|
sl@0
|
2577 |
//! @SYMTestCaseDesc Test that CFileMan::Move() works when the destination paths does not exist.
|
sl@0
|
2578 |
//! @SYMTestActions Copy directory structures to a non-existant directory on the same drive.
|
sl@0
|
2579 |
//! @SYMTestExpectedResults Completes with no error, files are copied and intermediate directories are created.
|
sl@0
|
2580 |
//! @SYMTestPriority High
|
sl@0
|
2581 |
//! @SYMTestStatus Implemented
|
sl@0
|
2582 |
//---------------------------------------------
|
sl@0
|
2583 |
test.Next(_L("Test moving when the target directory does not exist"));
|
sl@0
|
2584 |
|
sl@0
|
2585 |
SetupDirectories(ETrue, NULL);
|
sl@0
|
2586 |
|
sl@0
|
2587 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\"));
|
sl@0
|
2588 |
|
sl@0
|
2589 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse);
|
sl@0
|
2590 |
test(err == KErrNone);
|
sl@0
|
2591 |
|
sl@0
|
2592 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*"));
|
sl@0
|
2593 |
|
sl@0
|
2594 |
SetupDirectories(ETrue, NULL);
|
sl@0
|
2595 |
|
sl@0
|
2596 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\"));
|
sl@0
|
2597 |
|
sl@0
|
2598 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest"), CFileMan::ERecurse);
|
sl@0
|
2599 |
test(err == KErrNone);
|
sl@0
|
2600 |
|
sl@0
|
2601 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*"));
|
sl@0
|
2602 |
|
sl@0
|
2603 |
SetupDirectories(ETrue, NULL);
|
sl@0
|
2604 |
|
sl@0
|
2605 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\"));
|
sl@0
|
2606 |
|
sl@0
|
2607 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse);
|
sl@0
|
2608 |
test(err == KErrNone);
|
sl@0
|
2609 |
|
sl@0
|
2610 |
MakeDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
|
sl@0
|
2611 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*"));
|
sl@0
|
2612 |
RmDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
|
sl@0
|
2613 |
|
sl@0
|
2614 |
SetupDirectories(ETrue, NULL);
|
sl@0
|
2615 |
|
sl@0
|
2616 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\"));
|
sl@0
|
2617 |
|
sl@0
|
2618 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse);
|
sl@0
|
2619 |
test(err == KErrNone);
|
sl@0
|
2620 |
|
sl@0
|
2621 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), KErrNotFound, ETrue);
|
sl@0
|
2622 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\dest\\File1.TXT"), KErrNone, ETrue);
|
sl@0
|
2623 |
|
sl@0
|
2624 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\"));
|
sl@0
|
2625 |
RmDir(_L("\\F32-TST\\TFMAN\\source\\"));
|
sl@0
|
2626 |
|
sl@0
|
2627 |
// Test behaviour for omitted parameters
|
sl@0
|
2628 |
// For this, default should be session path
|
sl@0
|
2629 |
TFileName sessionPath;
|
sl@0
|
2630 |
err=TheFs.SessionPath(sessionPath);
|
sl@0
|
2631 |
test(err==KErrNone);
|
sl@0
|
2632 |
|
sl@0
|
2633 |
SetupDirectories(ETrue, NULL);
|
sl@0
|
2634 |
err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\dest\\"));
|
sl@0
|
2635 |
test(err == KErrNone);
|
sl@0
|
2636 |
|
sl@0
|
2637 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L(""), CFileMan::ERecurse);
|
sl@0
|
2638 |
test(err == KErrNone);
|
sl@0
|
2639 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*"));
|
sl@0
|
2640 |
|
sl@0
|
2641 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\"));
|
sl@0
|
2642 |
RmDir(_L("\\F32-TST\\TFMAN\\source\\"));
|
sl@0
|
2643 |
SetupDirectories(ETrue, NULL);
|
sl@0
|
2644 |
err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\"));
|
sl@0
|
2645 |
test(err == KErrNone);
|
sl@0
|
2646 |
|
sl@0
|
2647 |
err = gFileMan->Move(_L(""), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse);
|
sl@0
|
2648 |
test(err == KErrNone);
|
sl@0
|
2649 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*"));
|
sl@0
|
2650 |
|
sl@0
|
2651 |
err=TheFs.SetSessionPath(sessionPath);
|
sl@0
|
2652 |
test(err==KErrNone);
|
sl@0
|
2653 |
|
sl@0
|
2654 |
//---------------------------------------------
|
sl@0
|
2655 |
//! @SYMTestCaseID PBASE-T_FMAN-0520
|
sl@0
|
2656 |
//! @SYMTestType UT
|
sl@0
|
2657 |
//! @SYMREQ INC106735
|
sl@0
|
2658 |
//! @SYMTestCaseDesc Test that CFileMan::Move() (recursive mode) works properly when the destination
|
sl@0
|
2659 |
//! directory is sub-directory of the source directory.
|
sl@0
|
2660 |
//! (e.g. "C:SRC\\*.TXT" -> "C:\\SRC\\SUB\\")
|
sl@0
|
2661 |
//! @SYMTestActions Move, copy files recursively from source directory to one of its sub-directory,
|
sl@0
|
2662 |
//! with or without wildcards applied.
|
sl@0
|
2663 |
//! @SYMTestExpectedResults Completes with no error, file(s) are moved or copied properly, and no redundant
|
sl@0
|
2664 |
//! movings or copyings are made for files in destination directory.
|
sl@0
|
2665 |
//! @SYMTestPriority High
|
sl@0
|
2666 |
//! @SYMTestStatus Implemented
|
sl@0
|
2667 |
//---------------------------------------------
|
sl@0
|
2668 |
test.Next(_L("Test recursive moving and copying to sub-directories"));
|
sl@0
|
2669 |
// Testing recursive Move() without wildcard
|
sl@0
|
2670 |
SetupDirectoriesForCase0520();
|
sl@0
|
2671 |
SetupDirectoriesForCase0520Compare1();
|
sl@0
|
2672 |
if (!gAsynch)
|
sl@0
|
2673 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC106735\\F_ROOT.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\*"), CFileMan::ERecurse);
|
sl@0
|
2674 |
else
|
sl@0
|
2675 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC106735\\F_ROOT.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\*"), CFileMan::ERecurse, gStat);
|
sl@0
|
2676 |
TestResult(err, KErrNone);
|
sl@0
|
2677 |
Compare(_L("\\F32-TST\\TFMAN\\INC106735\\"), _L("\\F32-TST\\TFMAN\\INC106735_COM\\"));
|
sl@0
|
2678 |
|
sl@0
|
2679 |
// Testing recursive Move() with wildcard
|
sl@0
|
2680 |
SetupDirectoriesForCase0520();
|
sl@0
|
2681 |
SetupDirectoriesForCase0520Compare2();
|
sl@0
|
2682 |
if (!gAsynch)
|
sl@0
|
2683 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC106735\\*.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse);
|
sl@0
|
2684 |
else
|
sl@0
|
2685 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC106735\\*.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse, gStat);
|
sl@0
|
2686 |
TestResult(err, KErrNone);
|
sl@0
|
2687 |
Compare(_L("\\F32-TST\\TFMAN\\INC106735\\"), _L("\\F32-TST\\TFMAN\\INC106735_COM\\"));
|
sl@0
|
2688 |
|
sl@0
|
2689 |
// Testing recursive Copy() without wildcard
|
sl@0
|
2690 |
SetupDirectoriesForCase0520();
|
sl@0
|
2691 |
SetupDirectoriesForCase0520Compare3();
|
sl@0
|
2692 |
if (!gAsynch)
|
sl@0
|
2693 |
err = gFileMan->Copy(_L("\\F32-TST\\TFMAN\\INC106735\\F_ROOT.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse);
|
sl@0
|
2694 |
else
|
sl@0
|
2695 |
err = gFileMan->Copy(_L("\\F32-TST\\TFMAN\\INC106735\\F_ROOT.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse, gStat);
|
sl@0
|
2696 |
TestResult(err, KErrNone);
|
sl@0
|
2697 |
Compare(_L("\\F32-TST\\TFMAN\\INC106735\\"), _L("\\F32-TST\\TFMAN\\INC106735_COM\\"));
|
sl@0
|
2698 |
|
sl@0
|
2699 |
// Testing recursive Copy() with wildcard
|
sl@0
|
2700 |
SetupDirectoriesForCase0520();
|
sl@0
|
2701 |
SetupDirectoriesForCase0520Compare4();
|
sl@0
|
2702 |
if (!gAsynch)
|
sl@0
|
2703 |
err = gFileMan->Copy(_L("\\F32-TST\\TFMAN\\INC106735\\*.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse);
|
sl@0
|
2704 |
else
|
sl@0
|
2705 |
err = gFileMan->Copy(_L("\\F32-TST\\TFMAN\\INC106735\\*.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse, gStat);
|
sl@0
|
2706 |
TestResult(err, KErrNone);
|
sl@0
|
2707 |
Compare(_L("\\F32-TST\\TFMAN\\INC106735\\"), _L("\\F32-TST\\TFMAN\\INC106735_COM\\"));
|
sl@0
|
2708 |
|
sl@0
|
2709 |
TestINC089638(); // Test all items removed from source directory after recursive moving
|
sl@0
|
2710 |
TestINC101379(); // Test moving of directory to its subdirectory recursively and not recursively
|
sl@0
|
2711 |
TestINC099600(); // and INC101061, Test move files from internal drive to external with system
|
sl@0
|
2712 |
// and hidden attributes
|
sl@0
|
2713 |
}
|
sl@0
|
2714 |
|
sl@0
|
2715 |
|
sl@0
|
2716 |
//
|
sl@0
|
2717 |
// A complex test directory structure...
|
sl@0
|
2718 |
//
|
sl@0
|
2719 |
LOCAL_D const TInt KNumFiles = 8;
|
sl@0
|
2720 |
LOCAL_D const TFileName complexFile[] =
|
sl@0
|
2721 |
{
|
sl@0
|
2722 |
_L("\\F32-TST\\TFMAN\\complex\\dir1\\file1.txt"),
|
sl@0
|
2723 |
_L("\\F32-TST\\TFMAN\\complex\\dir1\\file2.txt"),
|
sl@0
|
2724 |
_L("\\F32-TST\\TFMAN\\complex\\dir1\\subdir1\\file3.txt"),
|
sl@0
|
2725 |
_L("\\F32-TST\\TFMAN\\complex\\dir1\\subdir1\\file4.txt"),
|
sl@0
|
2726 |
_L("\\F32-TST\\TFMAN\\complex\\dir12\\dir1\\file1.txt"),
|
sl@0
|
2727 |
_L("\\F32-TST\\TFMAN\\complex\\dir12\\dir1\\file2.txt"),
|
sl@0
|
2728 |
_L("\\F32-TST\\TFMAN\\complex\\dir12\\dir1\\subdir1\\file3.txt"),
|
sl@0
|
2729 |
_L("\\F32-TST\\TFMAN\\complex\\dir12\\dir1\\subdir1\\file4.txt")
|
sl@0
|
2730 |
};
|
sl@0
|
2731 |
|
sl@0
|
2732 |
//
|
sl@0
|
2733 |
// The expected result of moving the directory complex\\dir1 into complex\\dir2\\ *without* EOverWrite
|
sl@0
|
2734 |
//
|
sl@0
|
2735 |
LOCAL_D const TInt KNumFilesResult1 = 8;
|
sl@0
|
2736 |
LOCAL_D const TFileName complexResult1[] =
|
sl@0
|
2737 |
{
|
sl@0
|
2738 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir1\\file1.txt"),
|
sl@0
|
2739 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir1\\file2.txt"),
|
sl@0
|
2740 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir1\\subdir1\\file3.txt"),
|
sl@0
|
2741 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir1\\subdir1\\file4.txt"),
|
sl@0
|
2742 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir12\\dir1\\file1.txt"),
|
sl@0
|
2743 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir12\\dir1\\file2.txt"),
|
sl@0
|
2744 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir12\\dir1\\subdir1\\file3.txt"),
|
sl@0
|
2745 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir12\\dir1\\subdir1\\file4.txt")
|
sl@0
|
2746 |
};
|
sl@0
|
2747 |
|
sl@0
|
2748 |
//
|
sl@0
|
2749 |
// The expected result of moving the directory complex\\dir1 into complex\\dir2\\ *with* EOverWrite
|
sl@0
|
2750 |
//
|
sl@0
|
2751 |
LOCAL_D const TInt KNumFilesResult2 = 4;
|
sl@0
|
2752 |
LOCAL_D const TFileName complexResult2[] =
|
sl@0
|
2753 |
{
|
sl@0
|
2754 |
_L("\\F32-TST\\TFMAN\\complex_result2\\dir12\\dir1\\file1.txt"),
|
sl@0
|
2755 |
_L("\\F32-TST\\TFMAN\\complex_result2\\dir12\\dir1\\file2.txt"),
|
sl@0
|
2756 |
_L("\\F32-TST\\TFMAN\\complex_result2\\dir12\\dir1\\subdir1\\file3.txt"),
|
sl@0
|
2757 |
_L("\\F32-TST\\TFMAN\\complex_result2\\dir12\\dir1\\subdir1\\file4.txt"),
|
sl@0
|
2758 |
|
sl@0
|
2759 |
};
|
sl@0
|
2760 |
|
sl@0
|
2761 |
|
sl@0
|
2762 |
LOCAL_C void TestRecursiveMoveAcrossDrives()
|
sl@0
|
2763 |
//
|
sl@0
|
2764 |
// Test recursive move across drives
|
sl@0
|
2765 |
//
|
sl@0
|
2766 |
{
|
sl@0
|
2767 |
test.Next(_L("Test recursive move across drives"));
|
sl@0
|
2768 |
|
sl@0
|
2769 |
TFileName trgDir = _L("\\F32-TST\\TFMAN\\RECMOVE2\\");
|
sl@0
|
2770 |
TFileName trgSpec = _L("\\F32-TST\\TFMAN\\RECMOVE2\\*");
|
sl@0
|
2771 |
|
sl@0
|
2772 |
if (gSessionPath[0]=='C')
|
sl@0
|
2773 |
{
|
sl@0
|
2774 |
#if !defined(__WINS__)
|
sl@0
|
2775 |
trgDir = _L("D:\\F32-TST\\TFMAN\\RECMOVE2\\");
|
sl@0
|
2776 |
trgSpec = _L("D:\\F32-TST\\TFMAN\\RECMOVE2\\*");
|
sl@0
|
2777 |
#else
|
sl@0
|
2778 |
trgDir = _L("Y:\\F32-TST\\TFMAN\\RECMOVE2\\");
|
sl@0
|
2779 |
trgSpec = _L("Y:\\F32-TST\\TFMAN\\RECMOVE2\\*");
|
sl@0
|
2780 |
#endif
|
sl@0
|
2781 |
}
|
sl@0
|
2782 |
|
sl@0
|
2783 |
RmDir(trgDir);
|
sl@0
|
2784 |
|
sl@0
|
2785 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\FULL\\FILE2.PLP"));
|
sl@0
|
2786 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\FULL\\FILE3.PLP"));
|
sl@0
|
2787 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\FULL\\GRAPE.TXT"));
|
sl@0
|
2788 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\GRAPE.TXT"));
|
sl@0
|
2789 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\FILE1.PLP"));
|
sl@0
|
2790 |
|
sl@0
|
2791 |
TInt err;
|
sl@0
|
2792 |
if (!gAsynch)
|
sl@0
|
2793 |
err=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\*.PLP"),trgDir,CFileMan::ERecurse);
|
sl@0
|
2794 |
else
|
sl@0
|
2795 |
err=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\*.PLP"),trgDir,CFileMan::ERecurse,gStat);
|
sl@0
|
2796 |
test.Printf(_L("TestRecursiveMoveAcrossDrives(),gFileMan->Move(),err=%d\n"),err);
|
sl@0
|
2797 |
TestResult(err);
|
sl@0
|
2798 |
|
sl@0
|
2799 |
RmDir(_L("C:\\F32-TST\\TFMAN\\after\\"));
|
sl@0
|
2800 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\AFTER\\FULL\\FILE2.PLP"));
|
sl@0
|
2801 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\AFTER\\FULL\\FILE3.PLP"));
|
sl@0
|
2802 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\AFTER\\FILE1.PLP"));
|
sl@0
|
2803 |
Compare(_L("C:\\F32-TST\\TFMAN\\after\\*"),trgSpec);
|
sl@0
|
2804 |
RmDir(_L("C:\\F32-TST\\TFMAN\\AFTER\\"));
|
sl@0
|
2805 |
RmDir(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\"));
|
sl@0
|
2806 |
|
sl@0
|
2807 |
//
|
sl@0
|
2808 |
// Test moving empty directories (DEF073924)
|
sl@0
|
2809 |
//
|
sl@0
|
2810 |
test.Next(_L("Test moving empty directories"));
|
sl@0
|
2811 |
|
sl@0
|
2812 |
TFileName destOtherDrive;
|
sl@0
|
2813 |
SetupDirectories(EFalse, &destOtherDrive);
|
sl@0
|
2814 |
|
sl@0
|
2815 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse);
|
sl@0
|
2816 |
test(err == KErrNotFound); // Expected - directory is empty
|
sl@0
|
2817 |
|
sl@0
|
2818 |
// Test that all directories are still present
|
sl@0
|
2819 |
TEntry entry;
|
sl@0
|
2820 |
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry);
|
sl@0
|
2821 |
test(err == KErrNone);
|
sl@0
|
2822 |
err = TheFs.Entry(destOtherDrive, entry);
|
sl@0
|
2823 |
test(err == KErrNone);
|
sl@0
|
2824 |
|
sl@0
|
2825 |
//---------------------------------------------
|
sl@0
|
2826 |
//! @SYMTestCaseID PBASE-T_FMAN-0571
|
sl@0
|
2827 |
//! @SYMTestType UT
|
sl@0
|
2828 |
//! @SYMREQ INC108401
|
sl@0
|
2829 |
//! @SYMTestCaseDesc This testcase tests the synchronous and asynchronous move operations
|
sl@0
|
2830 |
//! exhaustively with flags set as 0, CFileMan::EOverWrite, CFileMan::ERecurse
|
sl@0
|
2831 |
//! on the SAME and ACROSS drives without trailing slash at the end of source
|
sl@0
|
2832 |
//! dir path.
|
sl@0
|
2833 |
//! @SYMTestActions 1. Copy directory structures to another directory across drive.
|
sl@0
|
2834 |
//! 2. Copy directory structures to another directory across drive overwriting
|
sl@0
|
2835 |
//! duplicate files.
|
sl@0
|
2836 |
//! 3. Copy directory structures to another directory across drive.
|
sl@0
|
2837 |
//! 4. Copy directory structures to another directory on same drive.
|
sl@0
|
2838 |
//! 5. Copy directory structures to another directory on same drive overwriting
|
sl@0
|
2839 |
//! duplicate files.
|
sl@0
|
2840 |
//! 6. Copy directory structures to another directory on same drive.
|
sl@0
|
2841 |
//! @SYMTestExpectedResults 1. Completes with no error, the last directory and its contents are moved
|
sl@0
|
2842 |
//! from the src directory to the destination directory.
|
sl@0
|
2843 |
//! 2. Completes with no error, the last directory and its contents are moved
|
sl@0
|
2844 |
//! from the src directory to the destination directory, duplicate files are updated.
|
sl@0
|
2845 |
//! 3. Completes with no error, the last directory and its contents are moved
|
sl@0
|
2846 |
//! from the src directory to the destination directory.
|
sl@0
|
2847 |
//! 4. Completes with no error, the last directory and its contents are moved
|
sl@0
|
2848 |
//! from the src directory to the destination directory.
|
sl@0
|
2849 |
//! 5. Completes with no error, the last directory and its contents are moved
|
sl@0
|
2850 |
//! from the src directory to the destination directory, duplicate files are updated.
|
sl@0
|
2851 |
//! 6. Completes with no error, the last directory and its contents are moved
|
sl@0
|
2852 |
//! from the src directory to the destination directory.
|
sl@0
|
2853 |
//! @SYMTestPriority High
|
sl@0
|
2854 |
//! @SYMTestStatus Implemented
|
sl@0
|
2855 |
//---------------------------------------------
|
sl@0
|
2856 |
|
sl@0
|
2857 |
TestINC108401();
|
sl@0
|
2858 |
|
sl@0
|
2859 |
//
|
sl@0
|
2860 |
// Test moving when the source directory contains subdirectories (INC074828, INC078800)
|
sl@0
|
2861 |
//
|
sl@0
|
2862 |
test.Next(_L("Test moving a directory containing subdirectories"));
|
sl@0
|
2863 |
|
sl@0
|
2864 |
SetupDirectories(ETrue, &destOtherDrive);
|
sl@0
|
2865 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse | CFileMan::EOverWrite);
|
sl@0
|
2866 |
test(err == KErrNone);
|
sl@0
|
2867 |
|
sl@0
|
2868 |
destOtherDrive.Append(_L("*"));
|
sl@0
|
2869 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
|
sl@0
|
2870 |
|
sl@0
|
2871 |
//---------------------------------------------
|
sl@0
|
2872 |
//! @SYMTestCaseID PBASE-T_FMAN-0161
|
sl@0
|
2873 |
//! @SYMTestType UT
|
sl@0
|
2874 |
//! @SYMREQ DEF087791
|
sl@0
|
2875 |
//! @SYMTestCaseDesc Test that CFileMan::Move() works when the destination paths does not exist.
|
sl@0
|
2876 |
//! @SYMTestActions Copy directory structures to a non-existant directory on a different drive.
|
sl@0
|
2877 |
//! @SYMTestExpectedResults Completes with no error, files are copied and intermediate directories are created.
|
sl@0
|
2878 |
//! @SYMTestPriority High
|
sl@0
|
2879 |
//! @SYMTestStatus Implemented
|
sl@0
|
2880 |
//---------------------------------------------
|
sl@0
|
2881 |
test.Next(_L("Test moving when the target directory does not exist"));
|
sl@0
|
2882 |
|
sl@0
|
2883 |
SetupDirectories(ETrue, &destOtherDrive);
|
sl@0
|
2884 |
|
sl@0
|
2885 |
RmDir(destOtherDrive);
|
sl@0
|
2886 |
|
sl@0
|
2887 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse);
|
sl@0
|
2888 |
test(err == KErrNone);
|
sl@0
|
2889 |
|
sl@0
|
2890 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
|
sl@0
|
2891 |
|
sl@0
|
2892 |
SetupDirectories(ETrue, &destOtherDrive);
|
sl@0
|
2893 |
|
sl@0
|
2894 |
RmDir(destOtherDrive);
|
sl@0
|
2895 |
|
sl@0
|
2896 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), destOtherDrive, CFileMan::ERecurse);
|
sl@0
|
2897 |
test(err == KErrNone);
|
sl@0
|
2898 |
|
sl@0
|
2899 |
MakeDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
|
sl@0
|
2900 |
destOtherDrive.Append(_L("source\\"));
|
sl@0
|
2901 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
|
sl@0
|
2902 |
RmDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
|
sl@0
|
2903 |
|
sl@0
|
2904 |
SetupDirectories(ETrue, &destOtherDrive);
|
sl@0
|
2905 |
|
sl@0
|
2906 |
RmDir(destOtherDrive);
|
sl@0
|
2907 |
|
sl@0
|
2908 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), destOtherDrive, CFileMan::ERecurse);
|
sl@0
|
2909 |
test(err == KErrNone);
|
sl@0
|
2910 |
|
sl@0
|
2911 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), KErrNotFound, ETrue);
|
sl@0
|
2912 |
destOtherDrive.Append(_L("File1.TXT"));
|
sl@0
|
2913 |
CheckFileExists(destOtherDrive, KErrNone, ETrue);
|
sl@0
|
2914 |
|
sl@0
|
2915 |
RmDir(destOtherDrive);
|
sl@0
|
2916 |
RmDir(_L("\\F32-TST\\TFMAN\\source\\"));
|
sl@0
|
2917 |
|
sl@0
|
2918 |
//
|
sl@0
|
2919 |
// Test recursive move of complex directory structure into itself (INC078759)
|
sl@0
|
2920 |
//
|
sl@0
|
2921 |
|
sl@0
|
2922 |
test.Next(_L("Test recursive move of complex directory structure"));
|
sl@0
|
2923 |
|
sl@0
|
2924 |
// Set up the test directory
|
sl@0
|
2925 |
TInt level = 0;
|
sl@0
|
2926 |
for(level=0; level < KNumFiles; level++)
|
sl@0
|
2927 |
{
|
sl@0
|
2928 |
err = TheFs.MkDirAll(complexFile[level]);
|
sl@0
|
2929 |
test(err == KErrNone || err == KErrAlreadyExists);
|
sl@0
|
2930 |
|
sl@0
|
2931 |
RFile file;
|
sl@0
|
2932 |
err = file.Create(TheFs, complexFile[level], EFileRead | EFileWrite);
|
sl@0
|
2933 |
test(err == KErrNone || err == KErrAlreadyExists || err == KErrBadName);
|
sl@0
|
2934 |
file.Close();
|
sl@0
|
2935 |
}
|
sl@0
|
2936 |
|
sl@0
|
2937 |
//
|
sl@0
|
2938 |
// Move directory 'dir1' into 'dir12' *without* overwrite flag set
|
sl@0
|
2939 |
//
|
sl@0
|
2940 |
// - This should fail, as 'dir12' already contains a directory called 'dir1'
|
sl@0
|
2941 |
// - No directories should be modified
|
sl@0
|
2942 |
//
|
sl@0
|
2943 |
|
sl@0
|
2944 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\complex\\dir1"), _L("\\F32-TST\\TFMAN\\complex\\dir12\\"), CFileMan::ERecurse);
|
sl@0
|
2945 |
test(err == KErrAlreadyExists);
|
sl@0
|
2946 |
|
sl@0
|
2947 |
for(level=0; level < KNumFilesResult1; level++)
|
sl@0
|
2948 |
{
|
sl@0
|
2949 |
err = TheFs.MkDirAll(complexResult1[level]);
|
sl@0
|
2950 |
test(err == KErrNone || err == KErrAlreadyExists);
|
sl@0
|
2951 |
|
sl@0
|
2952 |
RFile file;
|
sl@0
|
2953 |
err = file.Create(TheFs, complexResult1[level], EFileRead | EFileWrite);
|
sl@0
|
2954 |
test(err == KErrNone || err == KErrAlreadyExists || err == KErrBadName);
|
sl@0
|
2955 |
file.Close();
|
sl@0
|
2956 |
}
|
sl@0
|
2957 |
|
sl@0
|
2958 |
Compare(_L("\\F32-TST\\TFMAN\\complex_result1\\*"), _L("\\F32-TST\\TFMAN\\complex\\*"));
|
sl@0
|
2959 |
|
sl@0
|
2960 |
//
|
sl@0
|
2961 |
// Move directory 'dir1' into 'dir12' *with* overwrite flag set
|
sl@0
|
2962 |
//
|
sl@0
|
2963 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\complex\\dir1"), _L("\\F32-TST\\TFMAN\\complex\\dir12\\"), CFileMan::ERecurse | CFileMan::EOverWrite);
|
sl@0
|
2964 |
test(err == KErrNone);
|
sl@0
|
2965 |
|
sl@0
|
2966 |
for(level=0; level < KNumFilesResult2; level++)
|
sl@0
|
2967 |
{
|
sl@0
|
2968 |
err = TheFs.MkDirAll(complexResult2[level]);
|
sl@0
|
2969 |
test(err == KErrNone || err == KErrAlreadyExists);
|
sl@0
|
2970 |
|
sl@0
|
2971 |
RFile file;
|
sl@0
|
2972 |
err = file.Create(TheFs, complexResult2[level], EFileRead | EFileWrite);
|
sl@0
|
2973 |
test(err == KErrNone || err == KErrAlreadyExists || err == KErrBadName);
|
sl@0
|
2974 |
file.Close();
|
sl@0
|
2975 |
}
|
sl@0
|
2976 |
|
sl@0
|
2977 |
Compare(_L("\\F32-TST\\TFMAN\\complex_result2\\*"), _L("\\F32-TST\\TFMAN\\complex\\*"));
|
sl@0
|
2978 |
|
sl@0
|
2979 |
// ...tidy up files
|
sl@0
|
2980 |
for(level=0; level < KNumFiles; level++)
|
sl@0
|
2981 |
TheFs.Delete(complexFile[level]);
|
sl@0
|
2982 |
for(level=0; level < KNumFilesResult1; level++)
|
sl@0
|
2983 |
TheFs.Delete(complexResult1[level]);
|
sl@0
|
2984 |
for(level=0; level < KNumFilesResult2; level++)
|
sl@0
|
2985 |
TheFs.Delete(complexResult2[level]);
|
sl@0
|
2986 |
|
sl@0
|
2987 |
// ...tidy up directories
|
sl@0
|
2988 |
for(level=0; level < KNumFiles; level++)
|
sl@0
|
2989 |
TheFs.RmDir(complexFile[level]);
|
sl@0
|
2990 |
for(level=0; level < KNumFilesResult1; level++)
|
sl@0
|
2991 |
TheFs.RmDir(complexResult1[level]);
|
sl@0
|
2992 |
for(level=0; level < KNumFilesResult2; level++)
|
sl@0
|
2993 |
TheFs.RmDir(complexResult2[level]);
|
sl@0
|
2994 |
|
sl@0
|
2995 |
TheFs.RmDir(_L("C:\\F32-TST\\TFMAN\\"));
|
sl@0
|
2996 |
TheFs.RmDir(_L("C:\\F32-TST\\"));
|
sl@0
|
2997 |
}
|
sl@0
|
2998 |
|
sl@0
|
2999 |
class CFileManCopyAllCancel : public CBase, public MFileManObserver
|
sl@0
|
3000 |
{
|
sl@0
|
3001 |
public:
|
sl@0
|
3002 |
CFileManCopyAllCancel(CFileMan* aFileMan);
|
sl@0
|
3003 |
TControl NotifyFileManStarted();
|
sl@0
|
3004 |
TControl NotifyFileManEnded();
|
sl@0
|
3005 |
|
sl@0
|
3006 |
private:
|
sl@0
|
3007 |
CFileMan* iFileMan;
|
sl@0
|
3008 |
};
|
sl@0
|
3009 |
|
sl@0
|
3010 |
|
sl@0
|
3011 |
CFileManCopyAllCancel::CFileManCopyAllCancel(CFileMan* aFileMan)
|
sl@0
|
3012 |
//
|
sl@0
|
3013 |
// Constructor
|
sl@0
|
3014 |
//
|
sl@0
|
3015 |
{
|
sl@0
|
3016 |
__DECLARE_NAME(_S("CFileManCopyAllCancel"));
|
sl@0
|
3017 |
iFileMan=aFileMan;
|
sl@0
|
3018 |
}
|
sl@0
|
3019 |
|
sl@0
|
3020 |
MFileManObserver::TControl CFileManCopyAllCancel::NotifyFileManStarted()
|
sl@0
|
3021 |
//
|
sl@0
|
3022 |
// Observer for TestCopyAllCancel tests
|
sl@0
|
3023 |
//
|
sl@0
|
3024 |
{
|
sl@0
|
3025 |
return(MFileManObserver::ECancel);
|
sl@0
|
3026 |
}
|
sl@0
|
3027 |
|
sl@0
|
3028 |
MFileManObserver::TControl CFileManCopyAllCancel::NotifyFileManEnded()
|
sl@0
|
3029 |
//
|
sl@0
|
3030 |
// Observer for TestCopyAllCancel tests
|
sl@0
|
3031 |
//
|
sl@0
|
3032 |
{
|
sl@0
|
3033 |
return(MFileManObserver::EContinue);
|
sl@0
|
3034 |
}
|
sl@0
|
3035 |
|
sl@0
|
3036 |
|
sl@0
|
3037 |
|
sl@0
|
3038 |
LOCAL_C void TestCopyAllCancel()
|
sl@0
|
3039 |
//
|
sl@0
|
3040 |
// Test copy (all cancel)
|
sl@0
|
3041 |
//
|
sl@0
|
3042 |
{
|
sl@0
|
3043 |
test.Next(_L("Test copy all cancel"));
|
sl@0
|
3044 |
|
sl@0
|
3045 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\*"));
|
sl@0
|
3046 |
CFileManCopyAllCancel* fManObserver=new(ELeave) CFileManCopyAllCancel(gFileMan);
|
sl@0
|
3047 |
CleanupStack::PushL(fManObserver);
|
sl@0
|
3048 |
gFileMan->SetObserver(fManObserver);
|
sl@0
|
3049 |
|
sl@0
|
3050 |
MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
|
sl@0
|
3051 |
MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\"));
|
sl@0
|
3052 |
MakeFile(_L("\\F32-TST\\TFMAN\\NewDir\\ABC.DEF"));
|
sl@0
|
3053 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
|
sl@0
|
3054 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT"));
|
sl@0
|
3055 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE3.TXT"));
|
sl@0
|
3056 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\FILE4.TXT"));
|
sl@0
|
3057 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EXE1.BIN"));
|
sl@0
|
3058 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\EXE2.BIN"));
|
sl@0
|
3059 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA1.TXT"));
|
sl@0
|
3060 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA2.TXT"));
|
sl@0
|
3061 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA3.TXT"));
|
sl@0
|
3062 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA4.TXT"));
|
sl@0
|
3063 |
|
sl@0
|
3064 |
test.Next(_L("Test cancel copy all the files "));
|
sl@0
|
3065 |
TInt r;
|
sl@0
|
3066 |
|
sl@0
|
3067 |
if (!gAsynch)
|
sl@0
|
3068 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0);
|
sl@0
|
3069 |
else
|
sl@0
|
3070 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0,gStat);
|
sl@0
|
3071 |
TestResult(r,KErrCancel);
|
sl@0
|
3072 |
|
sl@0
|
3073 |
if (!gAsynch)
|
sl@0
|
3074 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.txt"),_L("\\F32-TST\\TFMAN\\file1.txt"),0);
|
sl@0
|
3075 |
else
|
sl@0
|
3076 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.txt"),_L("\\F32-TST\\TFMAN\\file1.txt"),0,gStat);
|
sl@0
|
3077 |
TestResult(r,KErrCancel);
|
sl@0
|
3078 |
gFileMan->SetObserver(gObserver);
|
sl@0
|
3079 |
CleanupStack::PopAndDestroy();
|
sl@0
|
3080 |
}
|
sl@0
|
3081 |
|
sl@0
|
3082 |
class CFileManObserverOverWrite : public CBase, public MFileManObserver
|
sl@0
|
3083 |
{
|
sl@0
|
3084 |
public:
|
sl@0
|
3085 |
CFileManObserverOverWrite(CFileMan* aFileMan);
|
sl@0
|
3086 |
TControl NotifyFileManEnded();
|
sl@0
|
3087 |
private:
|
sl@0
|
3088 |
CFileMan* iFileMan;
|
sl@0
|
3089 |
};
|
sl@0
|
3090 |
|
sl@0
|
3091 |
|
sl@0
|
3092 |
CFileManObserverOverWrite::CFileManObserverOverWrite(CFileMan* aFileMan)
|
sl@0
|
3093 |
//
|
sl@0
|
3094 |
// Constructor
|
sl@0
|
3095 |
//
|
sl@0
|
3096 |
{
|
sl@0
|
3097 |
__DECLARE_NAME(_S("CFileManObserverOverWrite"));
|
sl@0
|
3098 |
iFileMan=aFileMan;
|
sl@0
|
3099 |
}
|
sl@0
|
3100 |
|
sl@0
|
3101 |
|
sl@0
|
3102 |
MFileManObserver::TControl CFileManObserverOverWrite::NotifyFileManEnded()
|
sl@0
|
3103 |
//
|
sl@0
|
3104 |
// Observer for testoverwrite tests
|
sl@0
|
3105 |
//
|
sl@0
|
3106 |
{
|
sl@0
|
3107 |
TInt lastError=iFileMan->GetLastError();
|
sl@0
|
3108 |
if (lastError!=KErrNone)
|
sl@0
|
3109 |
{
|
sl@0
|
3110 |
test(lastError==KErrAlreadyExists);
|
sl@0
|
3111 |
if (gAsynch==EFalse)
|
sl@0
|
3112 |
{
|
sl@0
|
3113 |
TFileName fileName=iFileMan->CurrentEntry().iName;
|
sl@0
|
3114 |
test.Printf(_L(" %S already exists\n"),&fileName);
|
sl@0
|
3115 |
}
|
sl@0
|
3116 |
}
|
sl@0
|
3117 |
return(MFileManObserver::EContinue);
|
sl@0
|
3118 |
}
|
sl@0
|
3119 |
|
sl@0
|
3120 |
LOCAL_C void TestOverWrite()
|
sl@0
|
3121 |
//
|
sl@0
|
3122 |
// Test overwrite for copy and rename
|
sl@0
|
3123 |
//
|
sl@0
|
3124 |
{
|
sl@0
|
3125 |
test.Next(_L("Test overwrite option"));
|
sl@0
|
3126 |
RmDir(_L("\\F32-TST\\TFMAN\\OVERWRITE\\"));
|
sl@0
|
3127 |
CFileManObserverOverWrite* fManObserver=new(ELeave) CFileManObserverOverWrite(gFileMan);
|
sl@0
|
3128 |
CleanupStack::PushL(fManObserver);
|
sl@0
|
3129 |
gFileMan->SetObserver(fManObserver);
|
sl@0
|
3130 |
|
sl@0
|
3131 |
TBuf8<128> contentsFile1=_L8("Test file one contents");
|
sl@0
|
3132 |
TBuf8<128> contentsFile2=_L8("Test file two contents");
|
sl@0
|
3133 |
|
sl@0
|
3134 |
MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT"));
|
sl@0
|
3135 |
MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT"));
|
sl@0
|
3136 |
MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\FILE1.TXT"),contentsFile1);
|
sl@0
|
3137 |
MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\FILE2.TXT"),contentsFile2);
|
sl@0
|
3138 |
|
sl@0
|
3139 |
if (!gAsynch)
|
sl@0
|
3140 |
{
|
sl@0
|
3141 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),0);
|
sl@0
|
3142 |
test(r==KErrAlreadyExists);
|
sl@0
|
3143 |
}
|
sl@0
|
3144 |
else
|
sl@0
|
3145 |
{
|
sl@0
|
3146 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),0,gStat);
|
sl@0
|
3147 |
test(r==KErrNone);
|
sl@0
|
3148 |
WaitForResult(KErrAlreadyExists);
|
sl@0
|
3149 |
}
|
sl@0
|
3150 |
|
sl@0
|
3151 |
RFile f;
|
sl@0
|
3152 |
TInt r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT"),EFileRead);
|
sl@0
|
3153 |
test(r==KErrNone);
|
sl@0
|
3154 |
TBuf8<128> data;
|
sl@0
|
3155 |
r=f.Read(data);
|
sl@0
|
3156 |
test(r==KErrNone);
|
sl@0
|
3157 |
test(data.Length()==0);
|
sl@0
|
3158 |
f.Close();
|
sl@0
|
3159 |
|
sl@0
|
3160 |
if (!gAsynch)
|
sl@0
|
3161 |
{
|
sl@0
|
3162 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),CFileMan::EOverWrite);
|
sl@0
|
3163 |
test(r==KErrNone);
|
sl@0
|
3164 |
}
|
sl@0
|
3165 |
else
|
sl@0
|
3166 |
{
|
sl@0
|
3167 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),CFileMan::EOverWrite,gStat);
|
sl@0
|
3168 |
test(r==KErrNone);
|
sl@0
|
3169 |
WaitForSuccess();
|
sl@0
|
3170 |
}
|
sl@0
|
3171 |
|
sl@0
|
3172 |
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT"),EFileRead);
|
sl@0
|
3173 |
test(r==KErrNone);
|
sl@0
|
3174 |
r=f.Read(data);
|
sl@0
|
3175 |
test(r==KErrNone);
|
sl@0
|
3176 |
test(data==contentsFile1);
|
sl@0
|
3177 |
f.Close();
|
sl@0
|
3178 |
|
sl@0
|
3179 |
RmDir(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\"));
|
sl@0
|
3180 |
MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT"));
|
sl@0
|
3181 |
MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT"));
|
sl@0
|
3182 |
|
sl@0
|
3183 |
if (!gAsynch)
|
sl@0
|
3184 |
{
|
sl@0
|
3185 |
TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),0);
|
sl@0
|
3186 |
test(r==KErrAlreadyExists);
|
sl@0
|
3187 |
}
|
sl@0
|
3188 |
else
|
sl@0
|
3189 |
{
|
sl@0
|
3190 |
TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),0,gStat);
|
sl@0
|
3191 |
test(r==KErrNone);
|
sl@0
|
3192 |
WaitForResult(KErrAlreadyExists);
|
sl@0
|
3193 |
}
|
sl@0
|
3194 |
|
sl@0
|
3195 |
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT"),EFileRead);
|
sl@0
|
3196 |
test(r==KErrNone);
|
sl@0
|
3197 |
r=f.Read(data);
|
sl@0
|
3198 |
test(r==KErrNone);
|
sl@0
|
3199 |
test(data.Length()==0);
|
sl@0
|
3200 |
f.Close();
|
sl@0
|
3201 |
|
sl@0
|
3202 |
if (!gAsynch)
|
sl@0
|
3203 |
{
|
sl@0
|
3204 |
TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),CFileMan::EOverWrite);
|
sl@0
|
3205 |
test(r==KErrNone);
|
sl@0
|
3206 |
}
|
sl@0
|
3207 |
else
|
sl@0
|
3208 |
{
|
sl@0
|
3209 |
TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),CFileMan::EOverWrite,gStat);
|
sl@0
|
3210 |
test(r==KErrNone);
|
sl@0
|
3211 |
WaitForSuccess();
|
sl@0
|
3212 |
}
|
sl@0
|
3213 |
|
sl@0
|
3214 |
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT"),EFileRead);
|
sl@0
|
3215 |
test(r==KErrNone);
|
sl@0
|
3216 |
r=f.Read(data);
|
sl@0
|
3217 |
test(r==KErrNone);
|
sl@0
|
3218 |
test(data==contentsFile2);
|
sl@0
|
3219 |
f.Close();
|
sl@0
|
3220 |
gFileMan->SetObserver(gObserver);
|
sl@0
|
3221 |
CleanupStack::PopAndDestroy();
|
sl@0
|
3222 |
}
|
sl@0
|
3223 |
|
sl@0
|
3224 |
LOCAL_C void TestErrorHandling()
|
sl@0
|
3225 |
//
|
sl@0
|
3226 |
// Test bad paths etc
|
sl@0
|
3227 |
//
|
sl@0
|
3228 |
{
|
sl@0
|
3229 |
test.Next(_L("Test error handling"));
|
sl@0
|
3230 |
if (!gAsynch)
|
sl@0
|
3231 |
{
|
sl@0
|
3232 |
TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\BADPATH\\*"));
|
sl@0
|
3233 |
test(r==KErrPathNotFound);
|
sl@0
|
3234 |
}
|
sl@0
|
3235 |
else
|
sl@0
|
3236 |
{
|
sl@0
|
3237 |
TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\BADPATH\\*"),0,gStat);
|
sl@0
|
3238 |
test(r==KErrNone);
|
sl@0
|
3239 |
WaitForResult(KErrPathNotFound);
|
sl@0
|
3240 |
}
|
sl@0
|
3241 |
|
sl@0
|
3242 |
CFileMan* fMan=CFileMan::NewL(TheFs);
|
sl@0
|
3243 |
TInt r;
|
sl@0
|
3244 |
{
|
sl@0
|
3245 |
for(TInt drvNum=EDriveA; drvNum<=EDriveZ; ++drvNum)
|
sl@0
|
3246 |
{
|
sl@0
|
3247 |
TDriveInfo drvInfo;
|
sl@0
|
3248 |
if(KErrNone==TheFs.Drive(drvInfo, drvNum) && drvInfo.iType==EMediaNotPresent)
|
sl@0
|
3249 |
{
|
sl@0
|
3250 |
// found a non-extant drive, test it...
|
sl@0
|
3251 |
_LIT(KBad,"?:\\BADPATH\\*");
|
sl@0
|
3252 |
TBuf<16> bad(KBad);
|
sl@0
|
3253 |
bad[0] = TUint16('A'+drvNum);
|
sl@0
|
3254 |
TInt r=fMan->Delete(bad);
|
sl@0
|
3255 |
test(r==KErrNotReady);
|
sl@0
|
3256 |
break;
|
sl@0
|
3257 |
}
|
sl@0
|
3258 |
}
|
sl@0
|
3259 |
}
|
sl@0
|
3260 |
delete fMan;
|
sl@0
|
3261 |
|
sl@0
|
3262 |
MakeFile(_L("\\ONE\\TWO\\FILE1.TXT"));
|
sl@0
|
3263 |
MakeFile(_L("\\ONE\\TWO\\FOUR"));
|
sl@0
|
3264 |
test.Next(_L("Test cyclic copy"));
|
sl@0
|
3265 |
if (!gAsynch)
|
sl@0
|
3266 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\*"),_L("\\ONE\\TWO\\THREE\\"),CFileMan::ERecurse);
|
sl@0
|
3267 |
else
|
sl@0
|
3268 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\*"),_L("\\ONE\\TWO\\THREE\\"),CFileMan::ERecurse,gStat);
|
sl@0
|
3269 |
test(r==KErrArgument);
|
sl@0
|
3270 |
|
sl@0
|
3271 |
test.Next(_L("Test src name == trg name"));
|
sl@0
|
3272 |
if (!gAsynch)
|
sl@0
|
3273 |
{
|
sl@0
|
3274 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR")); // default aSwitch=EOverWrite
|
sl@0
|
3275 |
test(r==KErrNone);
|
sl@0
|
3276 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR"), 0);
|
sl@0
|
3277 |
test(r==KErrAlreadyExists);
|
sl@0
|
3278 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR"),CFileMan::ERecurse);
|
sl@0
|
3279 |
test(r==KErrAlreadyExists);
|
sl@0
|
3280 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\F*R"),_L("\\ONE\\TWO\\FOUR"),CFileMan::ERecurse);
|
sl@0
|
3281 |
test(r==KErrAlreadyExists);
|
sl@0
|
3282 |
}
|
sl@0
|
3283 |
else
|
sl@0
|
3284 |
{
|
sl@0
|
3285 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\*.TXT"),_L("\\ONE\\TWO\\*.TXT"),0,gStat);
|
sl@0
|
3286 |
test(r==KErrNone);
|
sl@0
|
3287 |
WaitForResult(KErrAlreadyExists);
|
sl@0
|
3288 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\F*R"),CFileMan::ERecurse,gStat);
|
sl@0
|
3289 |
test(r==KErrNone);
|
sl@0
|
3290 |
WaitForResult(KErrNone);
|
sl@0
|
3291 |
}
|
sl@0
|
3292 |
RmDir(_L("\\ONE\\"));
|
sl@0
|
3293 |
|
sl@0
|
3294 |
test.Next(_L("Test copy missing source and path"));
|
sl@0
|
3295 |
if (!gAsynch)
|
sl@0
|
3296 |
{
|
sl@0
|
3297 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"));
|
sl@0
|
3298 |
test(r==KErrPathNotFound);
|
sl@0
|
3299 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse);
|
sl@0
|
3300 |
test(r==KErrPathNotFound);
|
sl@0
|
3301 |
}
|
sl@0
|
3302 |
else
|
sl@0
|
3303 |
{
|
sl@0
|
3304 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\*.TXT"),_L("\\ONE\\TWO\\*.YYY"),0,gStat);
|
sl@0
|
3305 |
test(r==KErrNone);
|
sl@0
|
3306 |
WaitForResult(KErrPathNotFound);
|
sl@0
|
3307 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse,gStat);
|
sl@0
|
3308 |
test(r==KErrNone);
|
sl@0
|
3309 |
WaitForResult(KErrPathNotFound);
|
sl@0
|
3310 |
}
|
sl@0
|
3311 |
|
sl@0
|
3312 |
test.Next(_L("Test copy missing source"));
|
sl@0
|
3313 |
if (!gAsynch)
|
sl@0
|
3314 |
{
|
sl@0
|
3315 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\*.LPQ"),_L("\\ONE\\TWO\\*.YYY"));
|
sl@0
|
3316 |
test(r==KErrNotFound);
|
sl@0
|
3317 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse);
|
sl@0
|
3318 |
test(r==KErrNotFound);
|
sl@0
|
3319 |
}
|
sl@0
|
3320 |
else
|
sl@0
|
3321 |
{
|
sl@0
|
3322 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),0,gStat);
|
sl@0
|
3323 |
test(r==KErrNone);
|
sl@0
|
3324 |
WaitForResult(KErrNotFound);
|
sl@0
|
3325 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse,gStat);
|
sl@0
|
3326 |
test(r==KErrNone);
|
sl@0
|
3327 |
WaitForResult(KErrNotFound);
|
sl@0
|
3328 |
}
|
sl@0
|
3329 |
|
sl@0
|
3330 |
RmDir(_L("\\EMPTYSRC\\"));
|
sl@0
|
3331 |
MakeDir(_L("\\EMPTYSRC\\"));
|
sl@0
|
3332 |
RmDir(_L("\\EMPTYTRG\\"));
|
sl@0
|
3333 |
MakeDir(_L("\\EMPTYTRG\\"));
|
sl@0
|
3334 |
test.Next(_L("Test copy empty source directory"));
|
sl@0
|
3335 |
if (!gAsynch)
|
sl@0
|
3336 |
{
|
sl@0
|
3337 |
r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"));
|
sl@0
|
3338 |
test(r==KErrNotFound);
|
sl@0
|
3339 |
r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse);
|
sl@0
|
3340 |
test(r==KErrNotFound);
|
sl@0
|
3341 |
r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"));
|
sl@0
|
3342 |
test(r==KErrNotFound);
|
sl@0
|
3343 |
r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse);
|
sl@0
|
3344 |
test(r==KErrNotFound);
|
sl@0
|
3345 |
}
|
sl@0
|
3346 |
else
|
sl@0
|
3347 |
{
|
sl@0
|
3348 |
r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), 0, gStat);
|
sl@0
|
3349 |
test(r==KErrNone);
|
sl@0
|
3350 |
WaitForResult(KErrNotFound);
|
sl@0
|
3351 |
r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse, gStat);
|
sl@0
|
3352 |
test(r==KErrNone);
|
sl@0
|
3353 |
WaitForResult(KErrNotFound);
|
sl@0
|
3354 |
r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), 0, gStat);
|
sl@0
|
3355 |
test(r==KErrNone);
|
sl@0
|
3356 |
WaitForResult(KErrNotFound);
|
sl@0
|
3357 |
r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse, gStat);
|
sl@0
|
3358 |
test(r==KErrNone);
|
sl@0
|
3359 |
WaitForResult(KErrNotFound);
|
sl@0
|
3360 |
}
|
sl@0
|
3361 |
RmDir(_L("\\EMPTYSRC\\"));
|
sl@0
|
3362 |
RmDir(_L("\\EMPTYTRG\\"));
|
sl@0
|
3363 |
|
sl@0
|
3364 |
|
sl@0
|
3365 |
MakeFile(_L("Dummyfile"));
|
sl@0
|
3366 |
test.Next(_L("Test illegal names"));
|
sl@0
|
3367 |
r=gFileMan->Attribs(_L(":C:"),0,0,TTime(0),0);
|
sl@0
|
3368 |
test(r==KErrBadName);
|
sl@0
|
3369 |
r=gFileMan->Copy(_L(":C:"),_L("newname"),0);
|
sl@0
|
3370 |
test(r==KErrBadName);
|
sl@0
|
3371 |
r=gFileMan->Copy(_L("Dummyfile"),_L(":C:"),0);
|
sl@0
|
3372 |
test(r==KErrBadName);
|
sl@0
|
3373 |
r=gFileMan->Delete(_L(":C:"),0);
|
sl@0
|
3374 |
test(r==KErrBadName);
|
sl@0
|
3375 |
r=gFileMan->Move(_L(":C:"),_L("newname"),0);
|
sl@0
|
3376 |
test(r==KErrBadName);
|
sl@0
|
3377 |
r=gFileMan->Move(_L("dummyFile"),_L(":C:"),0);
|
sl@0
|
3378 |
test(r==KErrBadName);
|
sl@0
|
3379 |
r=gFileMan->Rename(_L(":C:"),_L("newname"),0);
|
sl@0
|
3380 |
test(r==KErrBadName);
|
sl@0
|
3381 |
r=gFileMan->Rename(_L("DummyFile"),_L(":C:"),0);
|
sl@0
|
3382 |
test(r==KErrBadName);
|
sl@0
|
3383 |
r=gFileMan->RmDir(_L("\\:C:\\"));
|
sl@0
|
3384 |
test(r==KErrBadName);
|
sl@0
|
3385 |
|
sl@0
|
3386 |
r=gFileMan->Attribs(_L("::C:"),0,0,TTime(0),0);
|
sl@0
|
3387 |
test(r==KErrBadName);
|
sl@0
|
3388 |
r=gFileMan->Copy(_L("::C:"),_L("newname"),0);
|
sl@0
|
3389 |
test(r==KErrBadName);
|
sl@0
|
3390 |
r=gFileMan->Copy(_L("Dummyfile"),_L("::C:"),0);
|
sl@0
|
3391 |
test(r==KErrBadName);
|
sl@0
|
3392 |
r=gFileMan->Delete(_L("::C:"),0);
|
sl@0
|
3393 |
test(r==KErrBadName);
|
sl@0
|
3394 |
r=gFileMan->Move(_L("::C:"),_L("newname"),0);
|
sl@0
|
3395 |
test(r==KErrBadName);
|
sl@0
|
3396 |
r=gFileMan->Move(_L("dummyFile"),_L("::C:"),0);
|
sl@0
|
3397 |
test(r==KErrBadName);
|
sl@0
|
3398 |
r=gFileMan->Rename(_L("::C:"),_L("newname"),0);
|
sl@0
|
3399 |
test(r==KErrBadName);
|
sl@0
|
3400 |
r=gFileMan->Rename(_L("DummyFile"),_L("::C:"),0);
|
sl@0
|
3401 |
test(r==KErrBadName);
|
sl@0
|
3402 |
r=gFileMan->RmDir(_L("::C:"));
|
sl@0
|
3403 |
test(r==KErrBadName);
|
sl@0
|
3404 |
r=TheFs.Delete(_L("DummyFile"));
|
sl@0
|
3405 |
test(r==KErrNone);
|
sl@0
|
3406 |
// test copying two files with identical names that do not exist
|
sl@0
|
3407 |
_LIT(KNonExistent,"\\azzzz.txt");
|
sl@0
|
3408 |
r=gFileMan->Copy(KNonExistent,KNonExistent,0);
|
sl@0
|
3409 |
test(r==KErrNotFound);
|
sl@0
|
3410 |
}
|
sl@0
|
3411 |
|
sl@0
|
3412 |
LOCAL_C void TestNameMangling()
|
sl@0
|
3413 |
//
|
sl@0
|
3414 |
// Synchronous test of name mangling
|
sl@0
|
3415 |
//
|
sl@0
|
3416 |
{
|
sl@0
|
3417 |
test.Next(_L("Test name mangling"));
|
sl@0
|
3418 |
gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\"));
|
sl@0
|
3419 |
MakeDir(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\"));
|
sl@0
|
3420 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abc.def"));
|
sl@0
|
3421 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abcdefghijk.def"));
|
sl@0
|
3422 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abc.defgh"));
|
sl@0
|
3423 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abcdefghijk.defgh"));
|
sl@0
|
3424 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abc.def"));
|
sl@0
|
3425 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abcdefghijk.def"));
|
sl@0
|
3426 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abc.defgh"));
|
sl@0
|
3427 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abcdefghijk.defgh"));
|
sl@0
|
3428 |
|
sl@0
|
3429 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*.*"));
|
sl@0
|
3430 |
test(r==KErrNone);
|
sl@0
|
3431 |
Compare(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\*"),_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*"));
|
sl@0
|
3432 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*.*"));
|
sl@0
|
3433 |
test(r==KErrNone);
|
sl@0
|
3434 |
}
|
sl@0
|
3435 |
|
sl@0
|
3436 |
LOCAL_C void TestLongNames()
|
sl@0
|
3437 |
//
|
sl@0
|
3438 |
// Synchronous test of name mangling
|
sl@0
|
3439 |
//
|
sl@0
|
3440 |
{
|
sl@0
|
3441 |
#if defined(__WINS__)
|
sl@0
|
3442 |
if (gSessionPath[0]=='C')
|
sl@0
|
3443 |
return;
|
sl@0
|
3444 |
#endif
|
sl@0
|
3445 |
|
sl@0
|
3446 |
gFileMan->SetObserver(NULL);
|
sl@0
|
3447 |
|
sl@0
|
3448 |
// Format the current drive
|
sl@0
|
3449 |
Format(CurrentDrive());
|
sl@0
|
3450 |
// Create Session Path
|
sl@0
|
3451 |
CreateTestDirectory(_L("\\F32-TST\\TFMAN\\"));
|
sl@0
|
3452 |
|
sl@0
|
3453 |
// Create 2 root directories with very long names
|
sl@0
|
3454 |
TInt longFileLength = KMaxFileName-4;
|
sl@0
|
3455 |
test.Next(_L("Test methods on long names"));
|
sl@0
|
3456 |
TFileName longFileNameA;
|
sl@0
|
3457 |
longFileNameA.SetLength(longFileLength);
|
sl@0
|
3458 |
longFileNameA.Fill('A',longFileLength);
|
sl@0
|
3459 |
TFileName longRootDirNameA=_L("\\");
|
sl@0
|
3460 |
longRootDirNameA+=longFileNameA;
|
sl@0
|
3461 |
longRootDirNameA+=_L("\\");
|
sl@0
|
3462 |
TInt r=TheFs.MkDir(longRootDirNameA);
|
sl@0
|
3463 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
3464 |
// Second folder
|
sl@0
|
3465 |
TFileName longFileNameB;
|
sl@0
|
3466 |
longFileNameB.SetLength(longFileLength);
|
sl@0
|
3467 |
longFileNameB.Fill('B',longFileLength);
|
sl@0
|
3468 |
TFileName longRootDirNameB=_L("\\");
|
sl@0
|
3469 |
longRootDirNameB+=longFileNameB;
|
sl@0
|
3470 |
longRootDirNameB+=_L("\\");
|
sl@0
|
3471 |
r=TheFs.MkDir(longRootDirNameB);
|
sl@0
|
3472 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
3473 |
|
sl@0
|
3474 |
TInt longFilePtrLength = KMaxFileName-3; // We do not want the trailing backslash
|
sl@0
|
3475 |
TPtrC ptrLongFileA(longRootDirNameA.Ptr(),longFilePtrLength);
|
sl@0
|
3476 |
TPtrC ptrLongFileB(longRootDirNameB.Ptr(),longFilePtrLength);
|
sl@0
|
3477 |
|
sl@0
|
3478 |
// TInt CFileMan::Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite);
|
sl@0
|
3479 |
// Tries to move a folder with a long name into another
|
sl@0
|
3480 |
// This test will return KErrGeneral because the new path will exceed the maximum length
|
sl@0
|
3481 |
// See KMaxFileName
|
sl@0
|
3482 |
r=gFileMan->Move(ptrLongFileA,ptrLongFileB);
|
sl@0
|
3483 |
test(r==KErrGeneral);
|
sl@0
|
3484 |
|
sl@0
|
3485 |
r=gFileMan->RmDir(longRootDirNameA);
|
sl@0
|
3486 |
test(r==KErrNone);
|
sl@0
|
3487 |
r=gFileMan->Rename(ptrLongFileB,ptrLongFileA);
|
sl@0
|
3488 |
test(r==KErrNone);
|
sl@0
|
3489 |
r=gFileMan->RmDir(longRootDirNameB);
|
sl@0
|
3490 |
test(r==KErrPathNotFound);
|
sl@0
|
3491 |
r=gFileMan->RmDir(longRootDirNameA);
|
sl@0
|
3492 |
test(r==KErrNone);
|
sl@0
|
3493 |
|
sl@0
|
3494 |
TFileName longSubDirName=_L("\\Files\\");
|
sl@0
|
3495 |
TPtrC longSubDirFileName(longFileNameA.Ptr(),longFilePtrLength-longSubDirName.Length());
|
sl@0
|
3496 |
longSubDirName+=longSubDirFileName;
|
sl@0
|
3497 |
longSubDirName+=_L("\\");
|
sl@0
|
3498 |
r=TheFs.MkDirAll(longSubDirName);
|
sl@0
|
3499 |
test(r==KErrNone);
|
sl@0
|
3500 |
|
sl@0
|
3501 |
CDir* dirList;
|
sl@0
|
3502 |
r=TheFs.GetDir(longSubDirName,KEntryAttMaskSupported,0,dirList);
|
sl@0
|
3503 |
test(r==KErrNone);
|
sl@0
|
3504 |
test(dirList->Count()==0);
|
sl@0
|
3505 |
delete dirList;
|
sl@0
|
3506 |
|
sl@0
|
3507 |
TPtrC ptrLongSubDirSrc(longSubDirName.Ptr(),longSubDirName.Length()-1);
|
sl@0
|
3508 |
TPtrC ptrLongSubDirTrg(longRootDirNameA.Ptr(),longRootDirNameA.Length()-1);
|
sl@0
|
3509 |
r=gFileMan->Copy(ptrLongSubDirSrc,ptrLongSubDirTrg);
|
sl@0
|
3510 |
test(r==KErrNone);
|
sl@0
|
3511 |
r=TheFs.MkDir(longRootDirNameB);
|
sl@0
|
3512 |
test(r==KErrNone);
|
sl@0
|
3513 |
r=gFileMan->Move(ptrLongSubDirSrc,longRootDirNameB);
|
sl@0
|
3514 |
test(r==KErrBadName);
|
sl@0
|
3515 |
r=TheFs.RmDir(longRootDirNameB);
|
sl@0
|
3516 |
test(r==KErrNone);
|
sl@0
|
3517 |
test(TheFs.RmDir(longSubDirName) == KErrNone);
|
sl@0
|
3518 |
test(TheFs.RmDir(_L("\\Files\\")) == KErrNone);
|
sl@0
|
3519 |
gFileMan->SetObserver(gObserver);
|
sl@0
|
3520 |
}
|
sl@0
|
3521 |
|
sl@0
|
3522 |
LOCAL_C void TestFileAttributes()
|
sl@0
|
3523 |
//
|
sl@0
|
3524 |
// Test file attributes are copied and new settings
|
sl@0
|
3525 |
//
|
sl@0
|
3526 |
{
|
sl@0
|
3527 |
test.Next(_L("Test file attributes are copied"));
|
sl@0
|
3528 |
gFileMan->Delete(_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*.*"));
|
sl@0
|
3529 |
MakeDir(_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\"));
|
sl@0
|
3530 |
MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\readonly.def"),KEntryAttReadOnly);
|
sl@0
|
3531 |
MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\readonlyhidden.def"),KEntryAttReadOnly|KEntryAttHidden);
|
sl@0
|
3532 |
MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\hiddensystem.def"),KEntryAttHidden|KEntryAttSystem);
|
sl@0
|
3533 |
MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\systemarchive.def"),KEntryAttArchive|KEntryAttSystem);
|
sl@0
|
3534 |
|
sl@0
|
3535 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*.*"));
|
sl@0
|
3536 |
test(r==KErrNone);
|
sl@0
|
3537 |
Compare(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*"));
|
sl@0
|
3538 |
r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*"),0,KEntryAttReadOnly,TTime(0));
|
sl@0
|
3539 |
test(r==KErrNone);
|
sl@0
|
3540 |
r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*"),0,KEntryAttReadOnly,TTime(0));
|
sl@0
|
3541 |
test(r==KErrNone);
|
sl@0
|
3542 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\FILEATT\\"));
|
sl@0
|
3543 |
test(r==KErrNone);
|
sl@0
|
3544 |
}
|
sl@0
|
3545 |
|
sl@0
|
3546 |
class CFileManObserverContinue : public CBase, public MFileManObserver
|
sl@0
|
3547 |
{
|
sl@0
|
3548 |
public:
|
sl@0
|
3549 |
CFileManObserverContinue(CFileMan* aFileMan);
|
sl@0
|
3550 |
TControl NotifyFileManEnded();
|
sl@0
|
3551 |
private:
|
sl@0
|
3552 |
CFileMan* iFileMan;
|
sl@0
|
3553 |
};
|
sl@0
|
3554 |
|
sl@0
|
3555 |
|
sl@0
|
3556 |
CFileManObserverContinue::CFileManObserverContinue(CFileMan* aFileMan)
|
sl@0
|
3557 |
//
|
sl@0
|
3558 |
// Constructor
|
sl@0
|
3559 |
//
|
sl@0
|
3560 |
{
|
sl@0
|
3561 |
__DECLARE_NAME(_S("CFileManObserverOverWrite"));
|
sl@0
|
3562 |
iFileMan=aFileMan;
|
sl@0
|
3563 |
}
|
sl@0
|
3564 |
|
sl@0
|
3565 |
|
sl@0
|
3566 |
MFileManObserver::TControl CFileManObserverContinue::NotifyFileManEnded()
|
sl@0
|
3567 |
//
|
sl@0
|
3568 |
// Observer for testoverwrite tests
|
sl@0
|
3569 |
//
|
sl@0
|
3570 |
{
|
sl@0
|
3571 |
return(MFileManObserver::EContinue);
|
sl@0
|
3572 |
}
|
sl@0
|
3573 |
|
sl@0
|
3574 |
LOCAL_C void TestCopyOpenFile()
|
sl@0
|
3575 |
//
|
sl@0
|
3576 |
// Copy a file while it is open
|
sl@0
|
3577 |
//
|
sl@0
|
3578 |
{
|
sl@0
|
3579 |
test.Next(_L("Test copying open files"));
|
sl@0
|
3580 |
|
sl@0
|
3581 |
CFileManObserverContinue* fManObserver=new(ELeave) CFileManObserverContinue(gFileMan);
|
sl@0
|
3582 |
gFileMan->SetObserver(fManObserver);
|
sl@0
|
3583 |
|
sl@0
|
3584 |
TBuf<256> contents;
|
sl@0
|
3585 |
TPtrC8 bufPtr;
|
sl@0
|
3586 |
CreateLongName(contents,gSeed,256);
|
sl@0
|
3587 |
bufPtr.Set((TUint8*)contents.Ptr(),contents.Size());
|
sl@0
|
3588 |
|
sl@0
|
3589 |
MakeFile(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),bufPtr);
|
sl@0
|
3590 |
RFile f;
|
sl@0
|
3591 |
TInt r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),EFileRead|EFileShareReadersOnly);
|
sl@0
|
3592 |
test(r==KErrNone);
|
sl@0
|
3593 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx"));
|
sl@0
|
3594 |
test(r==KErrNone);
|
sl@0
|
3595 |
f.Close();
|
sl@0
|
3596 |
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx"),EFileRead);
|
sl@0
|
3597 |
test(r==KErrNone);
|
sl@0
|
3598 |
TBuf8<256*sizeof(TText)> temp;
|
sl@0
|
3599 |
r=f.Read(temp);
|
sl@0
|
3600 |
test(r==KErrNone);
|
sl@0
|
3601 |
test(temp==bufPtr);
|
sl@0
|
3602 |
r=f.Read(temp);
|
sl@0
|
3603 |
test(r==KErrNone);
|
sl@0
|
3604 |
test(temp.Length()==0);
|
sl@0
|
3605 |
f.Close();
|
sl@0
|
3606 |
|
sl@0
|
3607 |
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),EFileRead);
|
sl@0
|
3608 |
test(r==KErrNone);
|
sl@0
|
3609 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx"));
|
sl@0
|
3610 |
test(r==KErrInUse);
|
sl@0
|
3611 |
f.Close();
|
sl@0
|
3612 |
|
sl@0
|
3613 |
gFileMan->SetObserver(gObserver);
|
sl@0
|
3614 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\FILECOPY\\"));
|
sl@0
|
3615 |
test(r==KErrNone);
|
sl@0
|
3616 |
delete fManObserver;
|
sl@0
|
3617 |
}
|
sl@0
|
3618 |
|
sl@0
|
3619 |
void TestINC101844()
|
sl@0
|
3620 |
{
|
sl@0
|
3621 |
test.Next(_L("Test move files and subdirs with different attributes (INC101844)"));
|
sl@0
|
3622 |
_LIT(KDest,"C:\\DEST101844\\");
|
sl@0
|
3623 |
TBuf<64> source;
|
sl@0
|
3624 |
source.Format(_L("%c:\\INC101844\\"), (TUint) gDriveToTest);
|
sl@0
|
3625 |
TBuf<64> src;
|
sl@0
|
3626 |
RmDir(source);
|
sl@0
|
3627 |
RmDir(KDest);
|
sl@0
|
3628 |
MakeDir(KDest);
|
sl@0
|
3629 |
TInt r;
|
sl@0
|
3630 |
|
sl@0
|
3631 |
// Create files and subdirs with different attributes
|
sl@0
|
3632 |
src = source;
|
sl@0
|
3633 |
src.Append(_L("file1"));
|
sl@0
|
3634 |
MakeFile(src, _L8("blah"));
|
sl@0
|
3635 |
TheFs.SetAtt(src, KEntryAttReadOnly, 0);
|
sl@0
|
3636 |
src = source;
|
sl@0
|
3637 |
src.Append(_L("file2"));
|
sl@0
|
3638 |
MakeFile(src, _L8("blah"));
|
sl@0
|
3639 |
TheFs.SetAtt(src, KEntryAttHidden, 0);
|
sl@0
|
3640 |
src = source;
|
sl@0
|
3641 |
src.Append(_L("file3"));
|
sl@0
|
3642 |
MakeFile(src, _L8("blah"));
|
sl@0
|
3643 |
TheFs.SetAtt(src, KEntryAttSystem, 0);
|
sl@0
|
3644 |
src = source;
|
sl@0
|
3645 |
src.Append(_L("subdir1\\file4"));
|
sl@0
|
3646 |
MakeFile(src, _L8("blah"));
|
sl@0
|
3647 |
TheFs.SetAtt(src, KEntryAttArchive, 0);
|
sl@0
|
3648 |
src = source;
|
sl@0
|
3649 |
src.Append(_L("subdir1"));
|
sl@0
|
3650 |
TheFs.SetAtt(src, KEntryAttSystem | KEntryAttHidden, KEntryAttArchive);
|
sl@0
|
3651 |
|
sl@0
|
3652 |
// Move directory containing files and subdirs with different attributes
|
sl@0
|
3653 |
r = gFileMan->Move(source, KDest, 0);
|
sl@0
|
3654 |
test(r==KErrNone);
|
sl@0
|
3655 |
|
sl@0
|
3656 |
// Check that the files and subdirs have moved and have the correct attributes
|
sl@0
|
3657 |
TEntry entry;
|
sl@0
|
3658 |
src = KDest;
|
sl@0
|
3659 |
src.Append(_L("file1"));
|
sl@0
|
3660 |
r = TheFs.Entry(src, entry);
|
sl@0
|
3661 |
test(r == KErrNone);
|
sl@0
|
3662 |
test(entry.iAtt&KEntryAttReadOnly);
|
sl@0
|
3663 |
|
sl@0
|
3664 |
src = KDest;
|
sl@0
|
3665 |
src.Append(_L("file2"));
|
sl@0
|
3666 |
r = TheFs.Entry(src, entry);
|
sl@0
|
3667 |
test(r == KErrNone);
|
sl@0
|
3668 |
test(entry.iAtt&KEntryAttHidden);
|
sl@0
|
3669 |
|
sl@0
|
3670 |
src = KDest;
|
sl@0
|
3671 |
src.Append(_L("file3"));
|
sl@0
|
3672 |
r = TheFs.Entry(src, entry);
|
sl@0
|
3673 |
test(r == KErrNone);
|
sl@0
|
3674 |
test(entry.iAtt&KEntryAttSystem);
|
sl@0
|
3675 |
|
sl@0
|
3676 |
src = source;
|
sl@0
|
3677 |
src.Append(_L("subdir1\\"));
|
sl@0
|
3678 |
r = gFileMan->Move(src, source, 0);
|
sl@0
|
3679 |
test(r == KErrNone);
|
sl@0
|
3680 |
|
sl@0
|
3681 |
r = TheFs.RmDir(src);
|
sl@0
|
3682 |
test(r==KErrNone);
|
sl@0
|
3683 |
src = source;
|
sl@0
|
3684 |
src.Append(_L("file4"));
|
sl@0
|
3685 |
r = TheFs.Delete(src);
|
sl@0
|
3686 |
test(r==KErrNone);
|
sl@0
|
3687 |
r = TheFs.RmDir(source);
|
sl@0
|
3688 |
test(r==KErrNone);
|
sl@0
|
3689 |
RmDir(KDest);
|
sl@0
|
3690 |
}
|
sl@0
|
3691 |
|
sl@0
|
3692 |
LOCAL_C void TestMoveAcrossDrives()
|
sl@0
|
3693 |
//
|
sl@0
|
3694 |
// Move a file from C: to the target drive
|
sl@0
|
3695 |
//
|
sl@0
|
3696 |
{
|
sl@0
|
3697 |
test.Next(_L("Test move across drives"));
|
sl@0
|
3698 |
|
sl@0
|
3699 |
TFileName trgDrive = _L("\\");
|
sl@0
|
3700 |
TFileName trgFile = _L("\\Sketch");
|
sl@0
|
3701 |
TFileName trgDir = _L("\\DRIVEMOVE\\");
|
sl@0
|
3702 |
TFileName trgDirFile = _L("\\DRIVEMOVE\\Sketch");
|
sl@0
|
3703 |
|
sl@0
|
3704 |
if (gSessionPath[0]=='C')
|
sl@0
|
3705 |
{
|
sl@0
|
3706 |
#if !defined(__WINS__)
|
sl@0
|
3707 |
trgDrive = _L("D:\\");
|
sl@0
|
3708 |
trgFile = _L("D:\\Sketch");
|
sl@0
|
3709 |
trgDir = _L("D:\\DRIVEMOVE\\");
|
sl@0
|
3710 |
trgDirFile = _L("D:\\DRIVEMOVE\\Sketch");
|
sl@0
|
3711 |
#else
|
sl@0
|
3712 |
trgDrive = _L("Y:\\");
|
sl@0
|
3713 |
trgFile = _L("Y:\\Sketch");
|
sl@0
|
3714 |
trgDir = _L("Y:\\DRIVEMOVE\\");
|
sl@0
|
3715 |
trgDirFile = _L("Y:\\DRIVEMOVE\\Sketch");
|
sl@0
|
3716 |
#endif
|
sl@0
|
3717 |
}
|
sl@0
|
3718 |
|
sl@0
|
3719 |
RmDir(trgDir);
|
sl@0
|
3720 |
RmDir(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\"));
|
sl@0
|
3721 |
|
sl@0
|
3722 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"));
|
sl@0
|
3723 |
|
sl@0
|
3724 |
// Move Sketch from the source to target
|
sl@0
|
3725 |
TInt r = gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),trgDrive);
|
sl@0
|
3726 |
test.Printf(_L("TestMoveAcrossDrives(),gFileMan->Move(),r=%d\n"),r);
|
sl@0
|
3727 |
// Check Sketch no longer exists on source drive
|
sl@0
|
3728 |
CheckFileExists(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),KErrNotFound);
|
sl@0
|
3729 |
// Check Sketch exists on target drive
|
sl@0
|
3730 |
CheckFileExists(trgFile,KErrNone);
|
sl@0
|
3731 |
|
sl@0
|
3732 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"));
|
sl@0
|
3733 |
// Move Directory DRIVEMOVE from the source to target
|
sl@0
|
3734 |
r = gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE"),trgDrive);
|
sl@0
|
3735 |
test.Printf(_L("TestMoveAcrossDrives(),gFileMan->Move(),r=%d\n"),r);
|
sl@0
|
3736 |
// Check DRIVEMOVE no longer exists on source drive
|
sl@0
|
3737 |
CheckFileExists(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),KErrPathNotFound);
|
sl@0
|
3738 |
// Check Sketch exists on target drive
|
sl@0
|
3739 |
CheckFileExists(trgDirFile,KErrNone);
|
sl@0
|
3740 |
|
sl@0
|
3741 |
RmDir(trgDir);
|
sl@0
|
3742 |
test(TheFs.Delete(trgFile) == KErrNone);
|
sl@0
|
3743 |
|
sl@0
|
3744 |
TestINC101844(); // Test move files and subdirs with different attributes
|
sl@0
|
3745 |
}
|
sl@0
|
3746 |
|
sl@0
|
3747 |
class CFileManObserverCopyAbort : public CBase, public MFileManObserver
|
sl@0
|
3748 |
{
|
sl@0
|
3749 |
public:
|
sl@0
|
3750 |
CFileManObserverCopyAbort(CFileMan* aFileMan);
|
sl@0
|
3751 |
TControl NotifyFileManEnded();
|
sl@0
|
3752 |
void SetAbortStep(TInt aAbortStep);
|
sl@0
|
3753 |
private:
|
sl@0
|
3754 |
CFileMan* iFileMan;
|
sl@0
|
3755 |
TInt iCurrentStep;
|
sl@0
|
3756 |
};
|
sl@0
|
3757 |
|
sl@0
|
3758 |
|
sl@0
|
3759 |
CFileManObserverCopyAbort::CFileManObserverCopyAbort(CFileMan* aFileMan)
|
sl@0
|
3760 |
//
|
sl@0
|
3761 |
// Constructor
|
sl@0
|
3762 |
//
|
sl@0
|
3763 |
: iFileMan(aFileMan),
|
sl@0
|
3764 |
iCurrentStep(0)
|
sl@0
|
3765 |
{
|
sl@0
|
3766 |
__DECLARE_NAME(_S("CFileManObserverCopyAbort"));
|
sl@0
|
3767 |
}
|
sl@0
|
3768 |
|
sl@0
|
3769 |
|
sl@0
|
3770 |
void CFileManObserverCopyAbort::SetAbortStep(TInt aAbortStep)
|
sl@0
|
3771 |
//
|
sl@0
|
3772 |
// Set the step at which to cancel the operation
|
sl@0
|
3773 |
//
|
sl@0
|
3774 |
{
|
sl@0
|
3775 |
iCurrentStep = aAbortStep;
|
sl@0
|
3776 |
}
|
sl@0
|
3777 |
|
sl@0
|
3778 |
|
sl@0
|
3779 |
MFileManObserver::TControl CFileManObserverCopyAbort::NotifyFileManEnded()
|
sl@0
|
3780 |
//
|
sl@0
|
3781 |
// Observer for testoverwrite tests
|
sl@0
|
3782 |
//
|
sl@0
|
3783 |
{
|
sl@0
|
3784 |
TInt lastError = iFileMan->GetLastError();
|
sl@0
|
3785 |
test(lastError == KErrNone);
|
sl@0
|
3786 |
|
sl@0
|
3787 |
TFileName srcfile;
|
sl@0
|
3788 |
iFileMan->GetCurrentSource(srcfile);
|
sl@0
|
3789 |
|
sl@0
|
3790 |
TInt action = iFileMan->CurrentAction();
|
sl@0
|
3791 |
test(action == CFileMan::EMove ||
|
sl@0
|
3792 |
action == CFileMan::EDelete ||
|
sl@0
|
3793 |
action == CFileMan::ERmDir);
|
sl@0
|
3794 |
|
sl@0
|
3795 |
iCurrentStep--;
|
sl@0
|
3796 |
return(iCurrentStep ? MFileManObserver::EContinue : MFileManObserver::EAbort);
|
sl@0
|
3797 |
}
|
sl@0
|
3798 |
|
sl@0
|
3799 |
LOCAL_C void TestAbortedMoveAcrossDrives()
|
sl@0
|
3800 |
//
|
sl@0
|
3801 |
// Move a file from C: to D: or Y:, and test various cancel conditions
|
sl@0
|
3802 |
//
|
sl@0
|
3803 |
{
|
sl@0
|
3804 |
test.Next(_L("Test cancel move across drives"));
|
sl@0
|
3805 |
|
sl@0
|
3806 |
const TInt KNumFiles = 5;
|
sl@0
|
3807 |
|
sl@0
|
3808 |
TFileName trgDirRoot = _L("\\F32-TST\\TFMAN\\");
|
sl@0
|
3809 |
TFileName trgDirFull = _L("\\F32-TST\\TFMAN\\CANCELMOVE\\");
|
sl@0
|
3810 |
TFileName trgDirFile = _L("\\F32-TST\\TFMAN\\CANCELMOVE\\FILE");
|
sl@0
|
3811 |
|
sl@0
|
3812 |
if (gSessionPath[0]=='C')
|
sl@0
|
3813 |
{
|
sl@0
|
3814 |
#if !defined(__WINS__)
|
sl@0
|
3815 |
trgDirRoot = _L("D:\\F32-TST\\TFMAN\\");
|
sl@0
|
3816 |
trgDirFull = _L("D:\\F32-TST\\TFMAN\\CANCELMOVE\\");
|
sl@0
|
3817 |
trgDirFile = _L("D:\\F32-TST\\TFMAN\\CANCELMOVE\\FILE");
|
sl@0
|
3818 |
#else
|
sl@0
|
3819 |
trgDirRoot = _L("Y:\\F32-TST\\TFMAN\\");
|
sl@0
|
3820 |
trgDirFull = _L("Y:\\F32-TST\\TFMAN\\CANCELMOVE\\");
|
sl@0
|
3821 |
trgDirFile = _L("Y:\\F32-TST\\TFMAN\\CANCELMOVE\\FILE");
|
sl@0
|
3822 |
#endif
|
sl@0
|
3823 |
}
|
sl@0
|
3824 |
|
sl@0
|
3825 |
gFileMan->RmDir(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE\\"));
|
sl@0
|
3826 |
|
sl@0
|
3827 |
CFileManObserverCopyAbort* fManObserver=new(ELeave) CFileManObserverCopyAbort(gFileMan);
|
sl@0
|
3828 |
CleanupStack::PushL(fManObserver);
|
sl@0
|
3829 |
|
sl@0
|
3830 |
// Check that source files exist when interrupting the copy step
|
sl@0
|
3831 |
TInt step = 0;
|
sl@0
|
3832 |
TInt i = 0;
|
sl@0
|
3833 |
for(step = 1; step <= KNumFiles+1; ++step)
|
sl@0
|
3834 |
{
|
sl@0
|
3835 |
for (i = 0; i < KNumFiles; i++)
|
sl@0
|
3836 |
{
|
sl@0
|
3837 |
TFileName sourceFile =_L("C:\\F32-TST\\TFMAN\\CANCELMOVE\\FILE");
|
sl@0
|
3838 |
sourceFile.AppendNum(i);
|
sl@0
|
3839 |
sourceFile.Append(_L(".TXT"));
|
sl@0
|
3840 |
MakeFile(sourceFile);
|
sl@0
|
3841 |
}
|
sl@0
|
3842 |
|
sl@0
|
3843 |
gFileMan->RmDir(trgDirFull);
|
sl@0
|
3844 |
|
sl@0
|
3845 |
fManObserver->SetAbortStep(step);
|
sl@0
|
3846 |
gFileMan->SetObserver(fManObserver);
|
sl@0
|
3847 |
|
sl@0
|
3848 |
TInt r;
|
sl@0
|
3849 |
if (!gAsynch)
|
sl@0
|
3850 |
r=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE"),trgDirRoot, CFileMan::EOverWrite);
|
sl@0
|
3851 |
else
|
sl@0
|
3852 |
r=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE"),trgDirRoot, CFileMan::EOverWrite, gStat);
|
sl@0
|
3853 |
|
sl@0
|
3854 |
test.Printf(_L("TestAbortedMoveAcrossDrives(),gFileMan->Move(),r=%d\n"),r);
|
sl@0
|
3855 |
TestResult(r, (step <= KNumFiles) ? KErrCancel : KErrNone);
|
sl@0
|
3856 |
|
sl@0
|
3857 |
gFileMan->SetObserver(NULL);
|
sl@0
|
3858 |
|
sl@0
|
3859 |
// Check that the expected target files exist...
|
sl@0
|
3860 |
CheckFileExists(trgDirFull, KErrNone, EFalse);
|
sl@0
|
3861 |
for (i = 0; i < Min(step, KNumFiles); i++)
|
sl@0
|
3862 |
{
|
sl@0
|
3863 |
TFileName trgAfterFile = trgDirFile;
|
sl@0
|
3864 |
trgAfterFile.AppendNum(i);
|
sl@0
|
3865 |
trgAfterFile.Append(_L(".TXT"));
|
sl@0
|
3866 |
CheckFileExists(trgAfterFile, KErrNone);
|
sl@0
|
3867 |
}
|
sl@0
|
3868 |
|
sl@0
|
3869 |
// Check that the expected source files still exist after the abort...
|
sl@0
|
3870 |
CheckFileExists(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE\\"), (step <= KNumFiles) ? KErrNone : KErrNotFound, EFalse);
|
sl@0
|
3871 |
for (; i < KNumFiles; i++)
|
sl@0
|
3872 |
{
|
sl@0
|
3873 |
TFileName srcAfterFile =_L("C:\\F32-TST\\TFMAN\\CANCELMOVE\\FILE");
|
sl@0
|
3874 |
srcAfterFile.AppendNum(i);
|
sl@0
|
3875 |
srcAfterFile.Append(_L(".TXT"));
|
sl@0
|
3876 |
CheckFileExists(srcAfterFile, KErrNone);
|
sl@0
|
3877 |
}
|
sl@0
|
3878 |
}
|
sl@0
|
3879 |
|
sl@0
|
3880 |
gFileMan->SetObserver(NULL);
|
sl@0
|
3881 |
CleanupStack::PopAndDestroy();
|
sl@0
|
3882 |
|
sl@0
|
3883 |
RmDir(trgDirRoot); // "?:\\F32-TST\\TFMAN\\"
|
sl@0
|
3884 |
TheFs.RmDir(trgDirRoot.Left(16));
|
sl@0
|
3885 |
TheFs.RmDir(trgDirRoot.Left(10));
|
sl@0
|
3886 |
TheFs.RmDir(_L("C:\\F32-TST\\TFMAN\\"));
|
sl@0
|
3887 |
TheFs.RmDir(_L("C:\\F32-TST\\"));
|
sl@0
|
3888 |
}
|
sl@0
|
3889 |
|
sl@0
|
3890 |
|
sl@0
|
3891 |
LOCAL_C void TestMoveEmptyDirectory()
|
sl@0
|
3892 |
//
|
sl@0
|
3893 |
// "Try to move an empty directory C:\F32-TST\TFMAN\DRIVEMOVE\ to C:\"
|
sl@0
|
3894 |
//
|
sl@0
|
3895 |
{
|
sl@0
|
3896 |
test.Next(_L("Test move empty directory"));
|
sl@0
|
3897 |
|
sl@0
|
3898 |
#if !defined(__WINS__)
|
sl@0
|
3899 |
TFileName trgDrive=_L("D:\\");
|
sl@0
|
3900 |
#else
|
sl@0
|
3901 |
if (gSessionPath[0]!='C')
|
sl@0
|
3902 |
return;
|
sl@0
|
3903 |
TFileName trgDrive=_L("C:\\");
|
sl@0
|
3904 |
#endif
|
sl@0
|
3905 |
|
sl@0
|
3906 |
MakeDir(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\"));
|
sl@0
|
3907 |
TInt r=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\*"),trgDrive,CFileMan::ERecurse);
|
sl@0
|
3908 |
test.Printf(_L("TestMoveEmptyDirectory(),gFileMan->Move(),r=%d\n"),r);
|
sl@0
|
3909 |
test (r==KErrNotFound);
|
sl@0
|
3910 |
}
|
sl@0
|
3911 |
|
sl@0
|
3912 |
LOCAL_C void TestCopyAndRename()
|
sl@0
|
3913 |
//
|
sl@0
|
3914 |
// Rename while copying files and directories
|
sl@0
|
3915 |
//
|
sl@0
|
3916 |
{
|
sl@0
|
3917 |
test.Next(_L("Test rename while copying files and directories"));
|
sl@0
|
3918 |
gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\CPMV"));
|
sl@0
|
3919 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\ONE_1.TXT"));
|
sl@0
|
3920 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\ONE_2.TXT"));
|
sl@0
|
3921 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\ONE_3.TXT"));
|
sl@0
|
3922 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\TWOTWO.TWO"));
|
sl@0
|
3923 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE_4.TXT"));
|
sl@0
|
3924 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE_5.TXT"));
|
sl@0
|
3925 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO.TXT"));
|
sl@0
|
3926 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO.GOD"));
|
sl@0
|
3927 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO.BAD"));
|
sl@0
|
3928 |
|
sl@0
|
3929 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\TWO.*"), _L("\\F32-TST\\TFMAN\\THREE.*"), CFileMan::ERecurse);
|
sl@0
|
3930 |
test(r==KErrNone);
|
sl@0
|
3931 |
|
sl@0
|
3932 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.TXT"), KErrNone);
|
sl@0
|
3933 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.GOD"), KErrNone);
|
sl@0
|
3934 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.BAD"), KErrNone);
|
sl@0
|
3935 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.*"));
|
sl@0
|
3936 |
test(r==KErrNone);
|
sl@0
|
3937 |
|
sl@0
|
3938 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__1.TXT"));
|
sl@0
|
3939 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__2.TXT"));
|
sl@0
|
3940 |
|
sl@0
|
3941 |
// copy and rename dir
|
sl@0
|
3942 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE"), CFileMan::ERecurse);
|
sl@0
|
3943 |
test(r==KErrNone);
|
sl@0
|
3944 |
Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\*"));
|
sl@0
|
3945 |
|
sl@0
|
3946 |
// copy and move into another dir
|
sl@0
|
3947 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO"), CFileMan::ERecurse);
|
sl@0
|
3948 |
test(r==KErrNone);
|
sl@0
|
3949 |
Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO\\*"));
|
sl@0
|
3950 |
|
sl@0
|
3951 |
// copy and rename files and dirs in current dir
|
sl@0
|
3952 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE*"), CFileMan::ERecurse);
|
sl@0
|
3953 |
test(r==KErrNone);
|
sl@0
|
3954 |
// Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE2\\*"));
|
sl@0
|
3955 |
|
sl@0
|
3956 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\THREEO.TWO"), KErrNone);
|
sl@0
|
3957 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO__1.TXT"), KErrNone);
|
sl@0
|
3958 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO__2.TXT"), KErrNone);
|
sl@0
|
3959 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.TXT"), KErrNone);
|
sl@0
|
3960 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.BAD"), KErrNone);
|
sl@0
|
3961 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.GOD"), KErrNone);
|
sl@0
|
3962 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\THREE1.TXT"), KErrNone);
|
sl@0
|
3963 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\THREE2.TXT"), KErrNone);
|
sl@0
|
3964 |
|
sl@0
|
3965 |
gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\CPMV\\"));
|
sl@0
|
3966 |
}
|
sl@0
|
3967 |
|
sl@0
|
3968 |
void TestStackUsage(TInt aLevel, TThreadStackInfo& aStack)
|
sl@0
|
3969 |
{
|
sl@0
|
3970 |
// DEF104115
|
sl@0
|
3971 |
_LIT(KDir, "\\DEF104115\\");
|
sl@0
|
3972 |
_LIT(KFile1, "\\DEF104115\\file1veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylong.txt");
|
sl@0
|
3973 |
_LIT(KFile2, "\\DEF104115\\SUBDIR\\longfile2.txt");
|
sl@0
|
3974 |
|
sl@0
|
3975 |
if(aLevel==0)
|
sl@0
|
3976 |
{
|
sl@0
|
3977 |
test.Next(_L("Test stack usage"));
|
sl@0
|
3978 |
RmDir(KDir);
|
sl@0
|
3979 |
MakeFile(KFile1, _L8("123456789012345678901234567890"));
|
sl@0
|
3980 |
MakeFile(KFile2);
|
sl@0
|
3981 |
}
|
sl@0
|
3982 |
TInt r = KErrNone;
|
sl@0
|
3983 |
char* start = NULL;
|
sl@0
|
3984 |
char* end = NULL;
|
sl@0
|
3985 |
TInt available = 0;
|
sl@0
|
3986 |
TInt stacksize = aStack.iBase - aStack.iLimit;
|
sl@0
|
3987 |
start = (char*)aStack.iLimit;
|
sl@0
|
3988 |
end = (char*)&stacksize;
|
sl@0
|
3989 |
available = (TInt)end - (TInt)start;
|
sl@0
|
3990 |
#ifdef __X86__
|
sl@0
|
3991 |
if(available > 6 * 1024) // X86 uses about twice as much stack as ARM in debug mode, so double the number.
|
sl@0
|
3992 |
#else
|
sl@0
|
3993 |
if(available > 3 * 1024) // don't touch this constant ... fix CFileMan instead!!
|
sl@0
|
3994 |
#endif
|
sl@0
|
3995 |
{
|
sl@0
|
3996 |
TestStackUsage(aLevel+1, aStack);
|
sl@0
|
3997 |
return;
|
sl@0
|
3998 |
}
|
sl@0
|
3999 |
|
sl@0
|
4000 |
test.Printf(_L("Level:%d Available:%d\n"), aLevel, available);
|
sl@0
|
4001 |
|
sl@0
|
4002 |
gFileMan->SetObserver(NULL);
|
sl@0
|
4003 |
// Attribs
|
sl@0
|
4004 |
r = gFileMan->Attribs(KDir, 0, 0, 0, CFileMan::ERecurse);
|
sl@0
|
4005 |
test(r==KErrNone);
|
sl@0
|
4006 |
|
sl@0
|
4007 |
// Move
|
sl@0
|
4008 |
r = gFileMan->Move(KFile1, KFile2, CFileMan::ERecurse);
|
sl@0
|
4009 |
test(r==KErrAlreadyExists);
|
sl@0
|
4010 |
|
sl@0
|
4011 |
r = gFileMan->Move(KFile1, KFile2, CFileMan::ERecurse | CFileMan::EOverWrite);
|
sl@0
|
4012 |
test(r==KErrNone);
|
sl@0
|
4013 |
|
sl@0
|
4014 |
// Copy
|
sl@0
|
4015 |
r = gFileMan->Copy(KFile2, KFile1, CFileMan::ERecurse);
|
sl@0
|
4016 |
test(r==KErrNone);
|
sl@0
|
4017 |
|
sl@0
|
4018 |
// Rename
|
sl@0
|
4019 |
r = gFileMan->Rename(KFile1, KFile2, 0);
|
sl@0
|
4020 |
test(r==KErrAlreadyExists);
|
sl@0
|
4021 |
|
sl@0
|
4022 |
r = gFileMan->Rename(KFile1, KFile2, CFileMan::EOverWrite);
|
sl@0
|
4023 |
test(r==KErrNone);
|
sl@0
|
4024 |
|
sl@0
|
4025 |
// Delete
|
sl@0
|
4026 |
r = gFileMan->Delete(KFile2, CFileMan::ERecurse);
|
sl@0
|
4027 |
test(r==KErrNone);
|
sl@0
|
4028 |
|
sl@0
|
4029 |
// RmDir
|
sl@0
|
4030 |
r = gFileMan->RmDir(KDir);
|
sl@0
|
4031 |
test(r==KErrNone);
|
sl@0
|
4032 |
|
sl@0
|
4033 |
gFileMan->SetObserver(gObserver);
|
sl@0
|
4034 |
}
|
sl@0
|
4035 |
|
sl@0
|
4036 |
LOCAL_C void InitialiseL()
|
sl@0
|
4037 |
//
|
sl@0
|
4038 |
// Set up test variables
|
sl@0
|
4039 |
//
|
sl@0
|
4040 |
{
|
sl@0
|
4041 |
gFileMan=CFileMan::NewL(TheFs);
|
sl@0
|
4042 |
gObserver=new(ELeave) CFileManObserver(gFileMan);
|
sl@0
|
4043 |
gFileMan->SetObserver(gObserver);
|
sl@0
|
4044 |
}
|
sl@0
|
4045 |
|
sl@0
|
4046 |
LOCAL_C void Cleanup()
|
sl@0
|
4047 |
//
|
sl@0
|
4048 |
// Cleanup test variables
|
sl@0
|
4049 |
//
|
sl@0
|
4050 |
{
|
sl@0
|
4051 |
delete gFileMan;
|
sl@0
|
4052 |
delete gObserver;
|
sl@0
|
4053 |
}
|
sl@0
|
4054 |
|
sl@0
|
4055 |
LOCAL_C void SetupDirStructure(TFileName& aSrcPath,TFileName& aTrgPath)
|
sl@0
|
4056 |
{
|
sl@0
|
4057 |
TFileName tmpName = aSrcPath;
|
sl@0
|
4058 |
|
sl@0
|
4059 |
// Create the TrgPath dirs
|
sl@0
|
4060 |
MakeDir(aTrgPath);
|
sl@0
|
4061 |
|
sl@0
|
4062 |
// Create the aSrcPath dirs
|
sl@0
|
4063 |
tmpName = aSrcPath;
|
sl@0
|
4064 |
tmpName.Append(_L("EmptyDir01\\"));
|
sl@0
|
4065 |
MakeDir(tmpName);
|
sl@0
|
4066 |
|
sl@0
|
4067 |
tmpName = aSrcPath;
|
sl@0
|
4068 |
tmpName.Append(_L("EmptyDir02\\"));
|
sl@0
|
4069 |
MakeDir(tmpName);
|
sl@0
|
4070 |
|
sl@0
|
4071 |
tmpName = aSrcPath;
|
sl@0
|
4072 |
tmpName.Append(_L("EmptyDir03\\"));
|
sl@0
|
4073 |
MakeDir(tmpName);
|
sl@0
|
4074 |
|
sl@0
|
4075 |
tmpName = aSrcPath;
|
sl@0
|
4076 |
tmpName.Append(_L("FILE01.TXT"));
|
sl@0
|
4077 |
MakeFile(tmpName);
|
sl@0
|
4078 |
|
sl@0
|
4079 |
tmpName = aSrcPath;
|
sl@0
|
4080 |
tmpName.Append(_L("FILE02.TXT"));
|
sl@0
|
4081 |
MakeFile(tmpName);
|
sl@0
|
4082 |
|
sl@0
|
4083 |
tmpName = aSrcPath;
|
sl@0
|
4084 |
tmpName.Append(_L("FILE03.TXT"));
|
sl@0
|
4085 |
MakeFile(tmpName);
|
sl@0
|
4086 |
|
sl@0
|
4087 |
tmpName = aSrcPath;
|
sl@0
|
4088 |
tmpName.Append(_L("SubDir01\\EmptyDir01\\"));
|
sl@0
|
4089 |
MakeDir(tmpName);
|
sl@0
|
4090 |
|
sl@0
|
4091 |
tmpName = aSrcPath;
|
sl@0
|
4092 |
tmpName.Append(_L("SubDir02\\EmptyDir02\\"));
|
sl@0
|
4093 |
MakeDir(tmpName);
|
sl@0
|
4094 |
|
sl@0
|
4095 |
tmpName = aSrcPath;
|
sl@0
|
4096 |
tmpName.Append(_L("SubDir03\\EmptyDir03\\"));
|
sl@0
|
4097 |
MakeDir(tmpName);
|
sl@0
|
4098 |
|
sl@0
|
4099 |
tmpName = aSrcPath;
|
sl@0
|
4100 |
tmpName.Append(_L("SubDir01\\FILE01.TXT"));
|
sl@0
|
4101 |
MakeFile(tmpName);
|
sl@0
|
4102 |
|
sl@0
|
4103 |
tmpName = aSrcPath;
|
sl@0
|
4104 |
tmpName.Append(_L("SubDir01\\FILE02.TXT"));
|
sl@0
|
4105 |
MakeFile(tmpName);
|
sl@0
|
4106 |
|
sl@0
|
4107 |
tmpName = aSrcPath;
|
sl@0
|
4108 |
tmpName.Append(_L("SubDir01\\FILE03.TXT"));
|
sl@0
|
4109 |
MakeFile(tmpName);
|
sl@0
|
4110 |
|
sl@0
|
4111 |
tmpName = aSrcPath;
|
sl@0
|
4112 |
tmpName.Append(_L("SubDir02\\FILE01.TXT"));
|
sl@0
|
4113 |
MakeFile(tmpName);
|
sl@0
|
4114 |
|
sl@0
|
4115 |
tmpName = aSrcPath;
|
sl@0
|
4116 |
tmpName.Append(_L("SubDir02\\FILE02.TXT"));
|
sl@0
|
4117 |
MakeFile(tmpName);
|
sl@0
|
4118 |
|
sl@0
|
4119 |
tmpName = aSrcPath;
|
sl@0
|
4120 |
tmpName.Append(_L("SubDir02\\FILE03.TXT"));
|
sl@0
|
4121 |
MakeFile(tmpName);
|
sl@0
|
4122 |
|
sl@0
|
4123 |
tmpName = aSrcPath;
|
sl@0
|
4124 |
tmpName.Append(_L("SubDir03\\FILE01.TXT"));
|
sl@0
|
4125 |
MakeFile(tmpName);
|
sl@0
|
4126 |
|
sl@0
|
4127 |
tmpName = aSrcPath;
|
sl@0
|
4128 |
tmpName.Append(_L("SubDir03\\FILE02.TXT"));
|
sl@0
|
4129 |
MakeFile(tmpName);
|
sl@0
|
4130 |
|
sl@0
|
4131 |
tmpName = aSrcPath;
|
sl@0
|
4132 |
tmpName.Append(_L("SubDir03\\FILE03.TXT"));
|
sl@0
|
4133 |
MakeFile(tmpName);
|
sl@0
|
4134 |
}
|
sl@0
|
4135 |
|
sl@0
|
4136 |
LOCAL_C void TestPDEF112148()
|
sl@0
|
4137 |
{
|
sl@0
|
4138 |
test.Next(_L("Test recursive and non-recursive move across drives (PDEF112148)"));
|
sl@0
|
4139 |
|
sl@0
|
4140 |
TInt err = 0;
|
sl@0
|
4141 |
|
sl@0
|
4142 |
TFileName trgPath;
|
sl@0
|
4143 |
trgPath.Format(_L("%c:\\F32-TST\\TFMAN\\PDEF112148\\dest\\"), (TUint8)gDriveToTest);
|
sl@0
|
4144 |
TFileName srcPath = _L("C:\\F32-TST\\TFMAN\\PDEF112148\\src\\");
|
sl@0
|
4145 |
|
sl@0
|
4146 |
// Non-Recursive move
|
sl@0
|
4147 |
// clean up before testing
|
sl@0
|
4148 |
RmDir(srcPath);
|
sl@0
|
4149 |
RmDir(trgPath);
|
sl@0
|
4150 |
// Setup the directory structure
|
sl@0
|
4151 |
SetupDirStructure(srcPath, trgPath);
|
sl@0
|
4152 |
if(!gAsynch)
|
sl@0
|
4153 |
err = gFileMan->Move(srcPath, trgPath, 0);
|
sl@0
|
4154 |
else
|
sl@0
|
4155 |
err = gFileMan->Move(srcPath, trgPath, 0, gStat);
|
sl@0
|
4156 |
TestResult(err);
|
sl@0
|
4157 |
|
sl@0
|
4158 |
// Verify src contents after move operation
|
sl@0
|
4159 |
CDir *dir = NULL;
|
sl@0
|
4160 |
err = TheFs.GetDir(srcPath, KEntryAttMaskSupported, ESortNone, dir);
|
sl@0
|
4161 |
test(6 == dir->Count());
|
sl@0
|
4162 |
delete dir;
|
sl@0
|
4163 |
// Verify dest contents after move operation
|
sl@0
|
4164 |
err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir);
|
sl@0
|
4165 |
test(3 == dir->Count());
|
sl@0
|
4166 |
delete dir;
|
sl@0
|
4167 |
|
sl@0
|
4168 |
// Recursive move with "\\" at the end of srcPath
|
sl@0
|
4169 |
// clean up before execution
|
sl@0
|
4170 |
RmDir(srcPath);
|
sl@0
|
4171 |
RmDir(trgPath);
|
sl@0
|
4172 |
// Setup the directory structure
|
sl@0
|
4173 |
SetupDirStructure(srcPath, trgPath);
|
sl@0
|
4174 |
if(!gAsynch)
|
sl@0
|
4175 |
err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse);
|
sl@0
|
4176 |
else
|
sl@0
|
4177 |
err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse, gStat);
|
sl@0
|
4178 |
TestResult(err);
|
sl@0
|
4179 |
|
sl@0
|
4180 |
// Verify src has no content
|
sl@0
|
4181 |
err = TheFs.GetDir(srcPath, KEntryAttMaskSupported, ESortNone, dir);
|
sl@0
|
4182 |
test(0 == dir->Count());
|
sl@0
|
4183 |
delete dir;
|
sl@0
|
4184 |
// Verify dest contents after move operation
|
sl@0
|
4185 |
err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir);
|
sl@0
|
4186 |
test(9 == dir->Count());
|
sl@0
|
4187 |
delete dir;
|
sl@0
|
4188 |
|
sl@0
|
4189 |
// Recursive move without "\\" at the end of srcPath
|
sl@0
|
4190 |
// clean up before execution
|
sl@0
|
4191 |
RmDir(srcPath);
|
sl@0
|
4192 |
RmDir(trgPath);
|
sl@0
|
4193 |
// Setup the directory structure
|
sl@0
|
4194 |
SetupDirStructure(srcPath, trgPath);
|
sl@0
|
4195 |
// Remove the "\\" at the end of srcPath for Recursive Move
|
sl@0
|
4196 |
srcPath.Delete(srcPath.Length()-1,1);
|
sl@0
|
4197 |
if(!gAsynch)
|
sl@0
|
4198 |
err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse);
|
sl@0
|
4199 |
else
|
sl@0
|
4200 |
err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse, gStat);
|
sl@0
|
4201 |
TestResult(err);
|
sl@0
|
4202 |
|
sl@0
|
4203 |
// Add the "\\" at the end of srcPath for verification
|
sl@0
|
4204 |
srcPath.Append(KPathDelimiter);
|
sl@0
|
4205 |
// Verify src doesnt not exist
|
sl@0
|
4206 |
err = gFileMan->RmDir(srcPath);
|
sl@0
|
4207 |
test(err==KErrPathNotFound); // KErrPathNotFound expected as src has been moved to dest
|
sl@0
|
4208 |
// Verify dest after move operation
|
sl@0
|
4209 |
err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir);
|
sl@0
|
4210 |
test(1 == dir->Count());
|
sl@0
|
4211 |
delete dir;
|
sl@0
|
4212 |
|
sl@0
|
4213 |
// clean up before leaving
|
sl@0
|
4214 |
RmDir(srcPath);
|
sl@0
|
4215 |
RmDir(trgPath);
|
sl@0
|
4216 |
}
|
sl@0
|
4217 |
//---------------------------------------------
|
sl@0
|
4218 |
//! @SYMTestCaseID PBASE-T_FMAN-2398
|
sl@0
|
4219 |
//! @SYMTestType UT
|
sl@0
|
4220 |
//! @SYMREQ DEF130678
|
sl@0
|
4221 |
//! @SYMTestCaseDesc Tests that CFileMan::Move itself does not leak any memory
|
sl@0
|
4222 |
//! @SYMTestActions Move files and keep checking the memory usage for each operation.
|
sl@0
|
4223 |
//! @SYMTestExpectedResults Test completes without any crash and hence without any memory leak.
|
sl@0
|
4224 |
//! @SYMTestPriority High
|
sl@0
|
4225 |
//! @SYMTestStatus Implemented
|
sl@0
|
4226 |
//---------------------------------------------
|
sl@0
|
4227 |
void TestDEF130678()
|
sl@0
|
4228 |
{
|
sl@0
|
4229 |
test.Next(_L("Test CFileMan::Move does not leak any memory"));
|
sl@0
|
4230 |
_LIT(KFromFile,"C:\\TestDEF130678\\FROM\\from_");
|
sl@0
|
4231 |
_LIT(KToFile,"C:\\TestDEF130678\\TO\\");
|
sl@0
|
4232 |
|
sl@0
|
4233 |
TInt run;
|
sl@0
|
4234 |
// choose a number that certainly tests all memory allocations.
|
sl@0
|
4235 |
// it is used for memory allocation failure simulation.
|
sl@0
|
4236 |
TInt maxRun = 50;
|
sl@0
|
4237 |
// start OOM loop
|
sl@0
|
4238 |
for(run=1; run<=maxRun; ++run)
|
sl@0
|
4239 |
{
|
sl@0
|
4240 |
TInt err = KErrNone;
|
sl@0
|
4241 |
TFileName fromFile, toFile;
|
sl@0
|
4242 |
|
sl@0
|
4243 |
fromFile.Append(KFromFile);
|
sl@0
|
4244 |
fromFile.AppendNum(run);
|
sl@0
|
4245 |
fromFile.Append(_L(".txt"));
|
sl@0
|
4246 |
MakeFile(fromFile);
|
sl@0
|
4247 |
|
sl@0
|
4248 |
MakeDir(_L("C:\\TestDEF130678\\FROM\\"));
|
sl@0
|
4249 |
MakeDir(_L("C:\\TestDEF130678\\TO\\"));
|
sl@0
|
4250 |
toFile.Append(KToFile);
|
sl@0
|
4251 |
|
sl@0
|
4252 |
// Check the memory usage
|
sl@0
|
4253 |
__UHEAP_MARK;
|
sl@0
|
4254 |
// set to fail every run-th memory allocation
|
sl@0
|
4255 |
__UHEAP_SETFAIL(RAllocator::EDeterministic, run);
|
sl@0
|
4256 |
|
sl@0
|
4257 |
CFileMan* fileMan = NULL;
|
sl@0
|
4258 |
TInt errTrap1 = KErrNone;
|
sl@0
|
4259 |
TRAP(errTrap1,(fileMan=CFileMan::NewL(TheFs)));
|
sl@0
|
4260 |
if (errTrap1 != KErrNone)
|
sl@0
|
4261 |
{
|
sl@0
|
4262 |
// reset the memory allocation failure and check for any leak
|
sl@0
|
4263 |
__UHEAP_RESET;
|
sl@0
|
4264 |
__UHEAP_MARKEND;
|
sl@0
|
4265 |
continue;
|
sl@0
|
4266 |
}
|
sl@0
|
4267 |
|
sl@0
|
4268 |
CleanupStack::PushL(fileMan);
|
sl@0
|
4269 |
TInt errTrap2 = KErrNone;
|
sl@0
|
4270 |
TRAP(errTrap2,(err = fileMan->Move(fromFile,toFile)));
|
sl@0
|
4271 |
if (errTrap2 != KErrNone || err != KErrNone)
|
sl@0
|
4272 |
{
|
sl@0
|
4273 |
CleanupStack::PopAndDestroy(fileMan);
|
sl@0
|
4274 |
// reset the memory allocation failure and check for any leak
|
sl@0
|
4275 |
__UHEAP_RESET;
|
sl@0
|
4276 |
__UHEAP_MARKEND;
|
sl@0
|
4277 |
continue;
|
sl@0
|
4278 |
}
|
sl@0
|
4279 |
CleanupStack::PopAndDestroy(fileMan);
|
sl@0
|
4280 |
// reset the memory allocation failure and check for any leak
|
sl@0
|
4281 |
__UHEAP_RESET;
|
sl@0
|
4282 |
__UHEAP_MARKEND;
|
sl@0
|
4283 |
} // End of OOM loop
|
sl@0
|
4284 |
|
sl@0
|
4285 |
// cleanup
|
sl@0
|
4286 |
RmDir(_L("C:\\TestDEF130678\\"));
|
sl@0
|
4287 |
}
|
sl@0
|
4288 |
|
sl@0
|
4289 |
GLDEF_C void CallTestsL()
|
sl@0
|
4290 |
//
|
sl@0
|
4291 |
// Do tests
|
sl@0
|
4292 |
//
|
sl@0
|
4293 |
{
|
sl@0
|
4294 |
// T_FMAN is independent of all tests so format first
|
sl@0
|
4295 |
#ifndef __WINS__
|
sl@0
|
4296 |
Format(CurrentDrive());
|
sl@0
|
4297 |
#endif
|
sl@0
|
4298 |
|
sl@0
|
4299 |
InitialiseL();
|
sl@0
|
4300 |
CreateTestDirectory(_L("\\F32-TST\\TFMAN\\"));
|
sl@0
|
4301 |
// May not be able to test handling of invalid path lengths because F32 fix
|
sl@0
|
4302 |
// to prevent paths >256 ever being created
|
sl@0
|
4303 |
testingInvalidPathLengths = CheckIfShortPathsAreSupported();
|
sl@0
|
4304 |
|
sl@0
|
4305 |
//-----------------------------------------------------------------------------------
|
sl@0
|
4306 |
// Asynchronous tests
|
sl@0
|
4307 |
//
|
sl@0
|
4308 |
gAsynch=ETrue;
|
sl@0
|
4309 |
test.Next(_L("Asynchronous tests ..."));
|
sl@0
|
4310 |
TheFs.SetAllocFailure(gAllocFailOff);
|
sl@0
|
4311 |
|
sl@0
|
4312 |
TInt uid;
|
sl@0
|
4313 |
test(HAL::Get(HAL::EMachineUid,uid)==KErrNone);
|
sl@0
|
4314 |
TBool doTargetTests = (!IsTestingLFFS() &&
|
sl@0
|
4315 |
uid!=HAL::EMachineUid_Cogent &&
|
sl@0
|
4316 |
uid!=HAL::EMachineUid_IQ80310 &&
|
sl@0
|
4317 |
uid!=HAL::EMachineUid_X86PC);
|
sl@0
|
4318 |
|
sl@0
|
4319 |
if (doTargetTests)
|
sl@0
|
4320 |
{
|
sl@0
|
4321 |
TestMoveAcrossDrives();
|
sl@0
|
4322 |
TestRecursiveMoveAcrossDrives();
|
sl@0
|
4323 |
TestMoveEmptyDirectory();
|
sl@0
|
4324 |
TestAbortedMoveAcrossDrives();
|
sl@0
|
4325 |
TestPDEF112148(); // Test recursive and non-recursive move across drives
|
sl@0
|
4326 |
}
|
sl@0
|
4327 |
|
sl@0
|
4328 |
TestOverWrite();
|
sl@0
|
4329 |
TestRename();
|
sl@0
|
4330 |
TestErrorHandling();
|
sl@0
|
4331 |
|
sl@0
|
4332 |
TestRecursiveMove();
|
sl@0
|
4333 |
TestRecursiveDelete();
|
sl@0
|
4334 |
TestRecursiveAttribs();
|
sl@0
|
4335 |
TestRecursiveCopy();
|
sl@0
|
4336 |
|
sl@0
|
4337 |
TestRmDir();
|
sl@0
|
4338 |
TestSimultaneous();
|
sl@0
|
4339 |
TestAttribs();
|
sl@0
|
4340 |
TestDelete();
|
sl@0
|
4341 |
if (!IsTestingLFFS())
|
sl@0
|
4342 |
TestCopy(); // ???
|
sl@0
|
4343 |
TestMove();
|
sl@0
|
4344 |
TestCopyAllCancel();
|
sl@0
|
4345 |
|
sl@0
|
4346 |
//-----------------------------------------------------------------------------------
|
sl@0
|
4347 |
// Synchronous tests
|
sl@0
|
4348 |
//
|
sl@0
|
4349 |
gAsynch=EFalse;
|
sl@0
|
4350 |
test.Next(_L("Synchronous tests ..."));
|
sl@0
|
4351 |
TheFs.SetAllocFailure(gAllocFailOn);
|
sl@0
|
4352 |
|
sl@0
|
4353 |
if (doTargetTests)
|
sl@0
|
4354 |
{
|
sl@0
|
4355 |
TestMoveAcrossDrives();
|
sl@0
|
4356 |
TestRecursiveMoveAcrossDrives();
|
sl@0
|
4357 |
TestMoveEmptyDirectory();
|
sl@0
|
4358 |
TestAbortedMoveAcrossDrives();
|
sl@0
|
4359 |
TestPDEF112148(); // Test recursive and non-recursive move across drives
|
sl@0
|
4360 |
}
|
sl@0
|
4361 |
|
sl@0
|
4362 |
TestCopyOpenFile();
|
sl@0
|
4363 |
if(testingInvalidPathLengths)
|
sl@0
|
4364 |
TestLongNames();
|
sl@0
|
4365 |
TestNameMangling();
|
sl@0
|
4366 |
TestFileAttributes();
|
sl@0
|
4367 |
TestOverWrite();
|
sl@0
|
4368 |
TestRename();
|
sl@0
|
4369 |
TestErrorHandling();
|
sl@0
|
4370 |
TestRecursiveMove();
|
sl@0
|
4371 |
TestRecursiveDelete();
|
sl@0
|
4372 |
TestRecursiveAttribs();
|
sl@0
|
4373 |
TestRecursiveCopy();
|
sl@0
|
4374 |
TestRmDir();
|
sl@0
|
4375 |
TestSimultaneous();
|
sl@0
|
4376 |
TestAttribs();
|
sl@0
|
4377 |
TestDelete();
|
sl@0
|
4378 |
TestCopy();
|
sl@0
|
4379 |
TestMove();
|
sl@0
|
4380 |
TestCopyAndRename();
|
sl@0
|
4381 |
TestCopyAllCancel();
|
sl@0
|
4382 |
|
sl@0
|
4383 |
TestDEF130678(); // Test CFileMan::Move does not leak any memory
|
sl@0
|
4384 |
#ifndef __WINS__
|
sl@0
|
4385 |
RThread t;
|
sl@0
|
4386 |
TThreadStackInfo stack;
|
sl@0
|
4387 |
test(t.StackInfo(stack)==KErrNone);
|
sl@0
|
4388 |
TestStackUsage(0, stack);
|
sl@0
|
4389 |
#endif
|
sl@0
|
4390 |
|
sl@0
|
4391 |
Cleanup();
|
sl@0
|
4392 |
DeleteTestDirectory();
|
sl@0
|
4393 |
test(TheFs.RmDir(_L("\\F32-TST\\")) == KErrNone);
|
sl@0
|
4394 |
}
|
sl@0
|
4395 |
|