sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@test
|
sl@0
|
21 |
@internalComponent
|
sl@0
|
22 |
|
sl@0
|
23 |
This contains CT_FsData
|
sl@0
|
24 |
*/
|
sl@0
|
25 |
|
sl@0
|
26 |
// User includes
|
sl@0
|
27 |
#include "T_FsData.h"
|
sl@0
|
28 |
#include "FileserverUtil.h"
|
sl@0
|
29 |
|
sl@0
|
30 |
// EPOC includes
|
sl@0
|
31 |
#include <e32cmn.h>
|
sl@0
|
32 |
|
sl@0
|
33 |
/*@{*/
|
sl@0
|
34 |
|
sl@0
|
35 |
// Parameters
|
sl@0
|
36 |
_LIT(KAttMask, "attmask" );
|
sl@0
|
37 |
_LIT(KPath, "path");
|
sl@0
|
38 |
_LIT(KDrive, "drive");
|
sl@0
|
39 |
_LIT(KDir, "dir");
|
sl@0
|
40 |
_LIT(KFile, "file");
|
sl@0
|
41 |
_LIT(KName, "name");
|
sl@0
|
42 |
_LIT(KNewName, "newname");
|
sl@0
|
43 |
_LIT(KOldName, "oldname");
|
sl@0
|
44 |
_LIT(KLongName, "longname");
|
sl@0
|
45 |
_LIT(KShortName, "shortname");
|
sl@0
|
46 |
_LIT(KLengthBuffer, "length_buffer");
|
sl@0
|
47 |
_LIT(KLengthRead, "length_read");
|
sl@0
|
48 |
_LIT(KEntrySortKey, "sortkey");
|
sl@0
|
49 |
_LIT(KEntrySetAttMask, "setattmask");
|
sl@0
|
50 |
_LIT(KEntryClearAttMask, "clearattmask");
|
sl@0
|
51 |
_LIT(KTime, "time");
|
sl@0
|
52 |
_LIT(KOffset, "offset");
|
sl@0
|
53 |
_LIT(KTUidType, "uidtype");
|
sl@0
|
54 |
_LIT(KIsDirList, "isdirlist");
|
sl@0
|
55 |
_LIT(KRelated, "related");
|
sl@0
|
56 |
_LIT(KBadChar, "badchar");
|
sl@0
|
57 |
_LIT(KIsBadChar, "isbadchar");
|
sl@0
|
58 |
_LIT(KCompareName, "comparename");
|
sl@0
|
59 |
_LIT(KComparePath, "comparepath");
|
sl@0
|
60 |
_LIT(KParseName, "parsename");
|
sl@0
|
61 |
_LIT(KParseDrive, "parsedrive");
|
sl@0
|
62 |
_LIT(KParsePath, "parsepath");
|
sl@0
|
63 |
_LIT(KParseExt, "parseext");
|
sl@0
|
64 |
_LIT(KIsExist, "isexist");
|
sl@0
|
65 |
_LIT(KIsSetAtt, "issetatt");
|
sl@0
|
66 |
_LIT(KSize, "size");
|
sl@0
|
67 |
_LIT(KIsOpen, "isopen");
|
sl@0
|
68 |
_LIT(KIsValid, "isvalid");
|
sl@0
|
69 |
_LIT(KIsInRom, "isinrom");
|
sl@0
|
70 |
_LIT(KDirEntryArray, "dirEntryObject");
|
sl@0
|
71 |
_LIT(KDirDirectoryArray, "dirDirectoryObject");
|
sl@0
|
72 |
_LIT(KObjectEntry, "entry" );
|
sl@0
|
73 |
|
sl@0
|
74 |
// Attributes for compare
|
sl@0
|
75 |
_LIT(KIsAttReadOnly, "isattreadonly");
|
sl@0
|
76 |
_LIT(KIsAttHidden, "isatthidden");
|
sl@0
|
77 |
_LIT(KIsAttSystem, "isattsystem");
|
sl@0
|
78 |
_LIT(KIsAttDir, "isattdir");
|
sl@0
|
79 |
_LIT(KIsAttArchive, "isattarchive");
|
sl@0
|
80 |
_LIT(KIsAttAllowUid, "isattuid");
|
sl@0
|
81 |
|
sl@0
|
82 |
// Commands
|
sl@0
|
83 |
_LIT(KCmdRealName, "RealName");
|
sl@0
|
84 |
_LIT(KCmdSessionPath, "SessionPath");
|
sl@0
|
85 |
_LIT(KCmdSetSessionPath, "SetSessionPath");
|
sl@0
|
86 |
_LIT(KCmdParse, "Parse");
|
sl@0
|
87 |
_LIT(KCmdMkDir, "MkDir");
|
sl@0
|
88 |
_LIT(KCmdMkDirAll, "MkDirAll");
|
sl@0
|
89 |
_LIT(KCmdRmDir, "RmDir");
|
sl@0
|
90 |
_LIT(KCmdGetDir, "GetDir");
|
sl@0
|
91 |
_LIT(KCmdDelete, "Delete");
|
sl@0
|
92 |
_LIT(KCmdRename, "Rename");
|
sl@0
|
93 |
_LIT(KCmdReplace, "Replace");
|
sl@0
|
94 |
_LIT(KCmdAtt, "Att");
|
sl@0
|
95 |
_LIT(KCmdSetAtt, "SetAtt");
|
sl@0
|
96 |
_LIT(KCmdModified, "Modified");
|
sl@0
|
97 |
_LIT(KCmdSetModified, "SetModified");
|
sl@0
|
98 |
_LIT(KCmdEntry, "Entry");
|
sl@0
|
99 |
_LIT(KCmdSetEntry, "SetEntry");
|
sl@0
|
100 |
_LIT(KCmdReadFileSection, "ReadFileSection");
|
sl@0
|
101 |
_LIT(KCmdIsFileOpen, "IsFileOpen");
|
sl@0
|
102 |
_LIT(KCmdGetShortName, "GetShortName");
|
sl@0
|
103 |
_LIT(KCmdGetLongName, "GetLongName");
|
sl@0
|
104 |
_LIT(KCmdIsFileInRom, "IsFileInRom");
|
sl@0
|
105 |
_LIT(KCmdIsValidName, "IsValidName");
|
sl@0
|
106 |
_LIT(KCmdSetSessionToPrivate, "SetSessionToPrivate");
|
sl@0
|
107 |
_LIT(KCmdPrivatePath, "PrivatePath");
|
sl@0
|
108 |
_LIT(KCmdCreatePrivatePath, "CreatePrivatePath");
|
sl@0
|
109 |
|
sl@0
|
110 |
// Sort key
|
sl@0
|
111 |
_LIT(KESortNone, "ESortNone");
|
sl@0
|
112 |
_LIT(KESortByName, "ESortByName");
|
sl@0
|
113 |
_LIT(KESortByExt, "ESortByExt");
|
sl@0
|
114 |
_LIT(KESortBySize, "ESortBySize");
|
sl@0
|
115 |
_LIT(KESortByDate, "ESortByDate");
|
sl@0
|
116 |
_LIT(KESortByUid, "ESortByUid");
|
sl@0
|
117 |
_LIT(KEDirsAnyOrder, "EDirsAnyOrder");
|
sl@0
|
118 |
_LIT(KEDirsFirst, "EDirsFirst");
|
sl@0
|
119 |
_LIT(KEDirsLast, "EDirsLast");
|
sl@0
|
120 |
_LIT(KEAscending, "EAscending");
|
sl@0
|
121 |
_LIT(KEDescending, "EDescending");
|
sl@0
|
122 |
_LIT(KEDirDescending, "EDirDescending");
|
sl@0
|
123 |
|
sl@0
|
124 |
// Attributes
|
sl@0
|
125 |
_LIT(KEntryAttUnknown, "KEntryAttUnknown");
|
sl@0
|
126 |
_LIT(KEntryAttReadOnlyStr, "KEntryAttReadOnly");
|
sl@0
|
127 |
_LIT(KEntryAttHiddenStr, "KEntryAttHidden");
|
sl@0
|
128 |
_LIT(KEntryAttSystemStr, "KEntryAttSystem");
|
sl@0
|
129 |
_LIT(KEntryAttVolumeStr, "KEntryAttVolume");
|
sl@0
|
130 |
_LIT(KEntryAttDirStr, "KEntryAttDir");
|
sl@0
|
131 |
_LIT(KEntryAttArchiveStr, "KEntryAttArchive");
|
sl@0
|
132 |
_LIT(KEntryAttAllowUidStr, "KEntryAttAllowUid");
|
sl@0
|
133 |
_LIT(KEntryAttXIPStr, "KEntryAttXIP");
|
sl@0
|
134 |
|
sl@0
|
135 |
// Constants
|
sl@0
|
136 |
_LIT(KTimeFormat, "%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B"); //SIZE 30
|
sl@0
|
137 |
#define KTimeFormatSize 30
|
sl@0
|
138 |
#define KShortNameSize 13
|
sl@0
|
139 |
#define KLongNameSize 256
|
sl@0
|
140 |
|
sl@0
|
141 |
/*@}*/
|
sl@0
|
142 |
|
sl@0
|
143 |
/**
|
sl@0
|
144 |
* Process a files related command read from the ini file
|
sl@0
|
145 |
*
|
sl@0
|
146 |
* @param aCommand the command to process
|
sl@0
|
147 |
* @param aSection the entry in the ini file requiring the command to be processed
|
sl@0
|
148 |
*
|
sl@0
|
149 |
* @return ETrue if the command is processed
|
sl@0
|
150 |
*/
|
sl@0
|
151 |
TBool CT_FsData::DoCommandFilesL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aSynchronous*/)
|
sl@0
|
152 |
{
|
sl@0
|
153 |
TBool retVal = ETrue;
|
sl@0
|
154 |
|
sl@0
|
155 |
if (aCommand == KCmdAtt)
|
sl@0
|
156 |
{
|
sl@0
|
157 |
DoCmdAtt(aSection);
|
sl@0
|
158 |
}
|
sl@0
|
159 |
else if (aCommand == KCmdCreatePrivatePath)
|
sl@0
|
160 |
{
|
sl@0
|
161 |
DoCmdCreatePrivatePath(aSection);
|
sl@0
|
162 |
}
|
sl@0
|
163 |
else if (aCommand == KCmdDelete)
|
sl@0
|
164 |
{
|
sl@0
|
165 |
DoCmdDelete(aSection);
|
sl@0
|
166 |
}
|
sl@0
|
167 |
else if (aCommand == KCmdEntry)
|
sl@0
|
168 |
{
|
sl@0
|
169 |
DoCmdEntryL(aSection);
|
sl@0
|
170 |
}
|
sl@0
|
171 |
else if (aCommand == KCmdGetDir)
|
sl@0
|
172 |
{
|
sl@0
|
173 |
DoCmdGetDir(aSection);
|
sl@0
|
174 |
}
|
sl@0
|
175 |
else if (aCommand == KCmdGetShortName)
|
sl@0
|
176 |
{
|
sl@0
|
177 |
DoCmdGetShortName(aSection);
|
sl@0
|
178 |
}
|
sl@0
|
179 |
else if (aCommand == KCmdGetLongName)
|
sl@0
|
180 |
{
|
sl@0
|
181 |
DoCmdGetLongName(aSection);
|
sl@0
|
182 |
}
|
sl@0
|
183 |
else if (aCommand == KCmdIsFileInRom)
|
sl@0
|
184 |
{
|
sl@0
|
185 |
DoCmdIsFileInRom(aSection);
|
sl@0
|
186 |
}
|
sl@0
|
187 |
else if (aCommand == KCmdIsFileOpen)
|
sl@0
|
188 |
{
|
sl@0
|
189 |
DoCmdIsFileOpen(aSection);
|
sl@0
|
190 |
}
|
sl@0
|
191 |
else if (aCommand == KCmdIsValidName)
|
sl@0
|
192 |
{
|
sl@0
|
193 |
DoCmdIsValidName(aSection);
|
sl@0
|
194 |
}
|
sl@0
|
195 |
else if (aCommand == KCmdMkDir)
|
sl@0
|
196 |
{
|
sl@0
|
197 |
DoCmdMkDir(aSection);
|
sl@0
|
198 |
}
|
sl@0
|
199 |
else if (aCommand == KCmdMkDirAll)
|
sl@0
|
200 |
{
|
sl@0
|
201 |
DoCmdMkDirAll(aSection);
|
sl@0
|
202 |
}
|
sl@0
|
203 |
else if (aCommand == KCmdModified)
|
sl@0
|
204 |
{
|
sl@0
|
205 |
DoCmdModified(aSection);
|
sl@0
|
206 |
}
|
sl@0
|
207 |
else if (aCommand == KCmdParse)
|
sl@0
|
208 |
{
|
sl@0
|
209 |
DoCmdParse(aSection);
|
sl@0
|
210 |
}
|
sl@0
|
211 |
else if (aCommand == KCmdPrivatePath)
|
sl@0
|
212 |
{
|
sl@0
|
213 |
DoCmdPrivatePath(aSection);
|
sl@0
|
214 |
}
|
sl@0
|
215 |
else if (aCommand == KCmdReadFileSection)
|
sl@0
|
216 |
{
|
sl@0
|
217 |
DoCmdReadFileSectionL(aSection);
|
sl@0
|
218 |
}
|
sl@0
|
219 |
else if (aCommand == KCmdRealName)
|
sl@0
|
220 |
{
|
sl@0
|
221 |
DoCmdRealName(aSection);
|
sl@0
|
222 |
}
|
sl@0
|
223 |
else if (aCommand == KCmdRename)
|
sl@0
|
224 |
{
|
sl@0
|
225 |
DoCmdRename(aSection);
|
sl@0
|
226 |
}
|
sl@0
|
227 |
else if (aCommand == KCmdReplace)
|
sl@0
|
228 |
{
|
sl@0
|
229 |
DoCmdReplace(aSection);
|
sl@0
|
230 |
}
|
sl@0
|
231 |
else if (aCommand == KCmdRmDir)
|
sl@0
|
232 |
{
|
sl@0
|
233 |
DoCmdRmDir(aSection);
|
sl@0
|
234 |
}
|
sl@0
|
235 |
else if (aCommand == KCmdSessionPath)
|
sl@0
|
236 |
{
|
sl@0
|
237 |
DoCmdSessionPath(aSection);
|
sl@0
|
238 |
}
|
sl@0
|
239 |
else if (aCommand == KCmdSetAtt)
|
sl@0
|
240 |
{
|
sl@0
|
241 |
DoCmdSetAtt(aSection);
|
sl@0
|
242 |
}
|
sl@0
|
243 |
else if (aCommand == KCmdSetEntry)
|
sl@0
|
244 |
{
|
sl@0
|
245 |
DoCmdSetEntry(aSection);
|
sl@0
|
246 |
}
|
sl@0
|
247 |
else if (aCommand == KCmdSetModified)
|
sl@0
|
248 |
{
|
sl@0
|
249 |
DoCmdSetModified(aSection);
|
sl@0
|
250 |
}
|
sl@0
|
251 |
else if (aCommand == KCmdSetSessionPath)
|
sl@0
|
252 |
{
|
sl@0
|
253 |
DoCmdSetSessionPath(aSection);
|
sl@0
|
254 |
}
|
sl@0
|
255 |
else if (aCommand == KCmdSetSessionToPrivate)
|
sl@0
|
256 |
{
|
sl@0
|
257 |
DoCmdSetSessionToPrivate(aSection);
|
sl@0
|
258 |
}
|
sl@0
|
259 |
else
|
sl@0
|
260 |
{
|
sl@0
|
261 |
retVal = EFalse;
|
sl@0
|
262 |
}
|
sl@0
|
263 |
|
sl@0
|
264 |
return retVal;
|
sl@0
|
265 |
}
|
sl@0
|
266 |
|
sl@0
|
267 |
void CT_FsData::DoCmdRealName(const TDesC& aSection)
|
sl@0
|
268 |
{
|
sl@0
|
269 |
// Gets name of file from ini file.
|
sl@0
|
270 |
TPtrC name;
|
sl@0
|
271 |
if (GET_MANDATORY_STRING_PARAMETER(KName(), aSection, name))
|
sl@0
|
272 |
{
|
sl@0
|
273 |
// Gets the real name of a file.
|
sl@0
|
274 |
TFileName realName;
|
sl@0
|
275 |
TInt err = iFs->RealName(name, realName);
|
sl@0
|
276 |
if (err != KErrNone)
|
sl@0
|
277 |
{
|
sl@0
|
278 |
ERR_PRINTF2(_L("RealName error %d"), err);
|
sl@0
|
279 |
SetError(err);
|
sl@0
|
280 |
}
|
sl@0
|
281 |
else
|
sl@0
|
282 |
{
|
sl@0
|
283 |
// Prints real name.
|
sl@0
|
284 |
INFO_PRINTF2(_L("Real name: %S"), &realName);
|
sl@0
|
285 |
|
sl@0
|
286 |
// Compares realname from ini file and realname from function.
|
sl@0
|
287 |
TPtrC compareName;
|
sl@0
|
288 |
if (GET_OPTIONAL_STRING_PARAMETER(KCompareName(), aSection, compareName))
|
sl@0
|
289 |
{
|
sl@0
|
290 |
if (compareName.CompareC(realName, 0, NULL) != 0)
|
sl@0
|
291 |
{
|
sl@0
|
292 |
ERR_PRINTF3(_L("Error compare %S != %S"), &realName, &compareName);
|
sl@0
|
293 |
SetBlockResult(EFail);
|
sl@0
|
294 |
}
|
sl@0
|
295 |
else
|
sl@0
|
296 |
{
|
sl@0
|
297 |
INFO_PRINTF3(_L("%S == %S"), &realName, &compareName);
|
sl@0
|
298 |
}
|
sl@0
|
299 |
}
|
sl@0
|
300 |
}
|
sl@0
|
301 |
}
|
sl@0
|
302 |
}
|
sl@0
|
303 |
|
sl@0
|
304 |
void CT_FsData::DoCmdSessionPath(const TDesC& aSection)
|
sl@0
|
305 |
{
|
sl@0
|
306 |
// Gets the session path.
|
sl@0
|
307 |
TBuf<KMaxTestExecuteCommandLength> path;
|
sl@0
|
308 |
TInt err = iFs->SessionPath(path);
|
sl@0
|
309 |
if (err != KErrNone)
|
sl@0
|
310 |
{
|
sl@0
|
311 |
ERR_PRINTF2(_L("SessionPath error %d"), err);
|
sl@0
|
312 |
SetError(err);
|
sl@0
|
313 |
}
|
sl@0
|
314 |
else
|
sl@0
|
315 |
{
|
sl@0
|
316 |
// Prints session path.
|
sl@0
|
317 |
INFO_PRINTF2(_L("Session path is %S"), &path);
|
sl@0
|
318 |
|
sl@0
|
319 |
// Compares path from ini file and path from function.
|
sl@0
|
320 |
TPtrC comparePath;
|
sl@0
|
321 |
if (GET_OPTIONAL_STRING_PARAMETER(KComparePath(), aSection, comparePath))
|
sl@0
|
322 |
{
|
sl@0
|
323 |
if (comparePath.CompareC(path, 0, NULL) != 0)
|
sl@0
|
324 |
{
|
sl@0
|
325 |
ERR_PRINTF3(_L("Error compare %S != %S"), &path, &comparePath);
|
sl@0
|
326 |
SetBlockResult(EFail);
|
sl@0
|
327 |
}
|
sl@0
|
328 |
else
|
sl@0
|
329 |
{
|
sl@0
|
330 |
INFO_PRINTF3(_L("%S == %S"), &path, &comparePath);
|
sl@0
|
331 |
}
|
sl@0
|
332 |
}
|
sl@0
|
333 |
}
|
sl@0
|
334 |
}
|
sl@0
|
335 |
|
sl@0
|
336 |
void CT_FsData::DoCmdSetSessionPath(const TDesC& aSection)
|
sl@0
|
337 |
{
|
sl@0
|
338 |
// Gets path from ini file.
|
sl@0
|
339 |
TPtrC path;
|
sl@0
|
340 |
if (GET_MANDATORY_STRING_PARAMETER(KPath(), aSection, path))
|
sl@0
|
341 |
{
|
sl@0
|
342 |
// Sets the session path for the current file server client.
|
sl@0
|
343 |
TInt err = iFs->SetSessionPath(path);
|
sl@0
|
344 |
if (err != KErrNone)
|
sl@0
|
345 |
{
|
sl@0
|
346 |
ERR_PRINTF2(_L("SetSessionPath error %d"), err);
|
sl@0
|
347 |
SetError(err);
|
sl@0
|
348 |
}
|
sl@0
|
349 |
else
|
sl@0
|
350 |
{
|
sl@0
|
351 |
// Prints session path.
|
sl@0
|
352 |
INFO_PRINTF2(_L("Path is set into %S"), &path);
|
sl@0
|
353 |
}
|
sl@0
|
354 |
}
|
sl@0
|
355 |
}
|
sl@0
|
356 |
|
sl@0
|
357 |
void CT_FsData::DoCmdParse(const TDesC& aSection)
|
sl@0
|
358 |
{
|
sl@0
|
359 |
// Gets name of file from ini file.
|
sl@0
|
360 |
TPtrC name;
|
sl@0
|
361 |
if (GET_MANDATORY_STRING_PARAMETER(KName(), aSection, name))
|
sl@0
|
362 |
{
|
sl@0
|
363 |
TInt err;
|
sl@0
|
364 |
TParse parse;
|
sl@0
|
365 |
TPtrC related;
|
sl@0
|
366 |
|
sl@0
|
367 |
// Reads the related file specification.
|
sl@0
|
368 |
if (GET_OPTIONAL_STRING_PARAMETER(KRelated(), aSection, related))
|
sl@0
|
369 |
{
|
sl@0
|
370 |
INFO_PRINTF2(_L("Related parameter: %S"), &related);
|
sl@0
|
371 |
|
sl@0
|
372 |
// Parses a filename specification, specifying related file path components.
|
sl@0
|
373 |
err = iFs->Parse(name, related, parse);
|
sl@0
|
374 |
}
|
sl@0
|
375 |
else
|
sl@0
|
376 |
{
|
sl@0
|
377 |
// Parses a filename specification.
|
sl@0
|
378 |
err = iFs->Parse(name, parse);
|
sl@0
|
379 |
}
|
sl@0
|
380 |
|
sl@0
|
381 |
if (err != KErrNone)
|
sl@0
|
382 |
{
|
sl@0
|
383 |
ERR_PRINTF2(_L("Parse error %d"), err);
|
sl@0
|
384 |
SetError(err);
|
sl@0
|
385 |
}
|
sl@0
|
386 |
else
|
sl@0
|
387 |
{
|
sl@0
|
388 |
// Writes parsed components to log file.
|
sl@0
|
389 |
TPtrC parsedResult[] =
|
sl@0
|
390 |
{
|
sl@0
|
391 |
parse.Drive(), //parsedDrive,
|
sl@0
|
392 |
parse.Path(), //parsedPath,
|
sl@0
|
393 |
parse.Name(), //parsedName,
|
sl@0
|
394 |
parse.Ext() //parsedExt,
|
sl@0
|
395 |
};// size 4
|
sl@0
|
396 |
|
sl@0
|
397 |
TBuf<KMaxTestExecuteCommandLength> tempStore;
|
sl@0
|
398 |
tempStore.Format(_L("Parsed %S, Drive: %S, Path: %S, Name: %S, Ext: %S"), &name,
|
sl@0
|
399 |
&parsedResult[0], //Drive
|
sl@0
|
400 |
&parsedResult[1], //Path
|
sl@0
|
401 |
&parsedResult[2], //Name
|
sl@0
|
402 |
&parsedResult[3]);//Ext
|
sl@0
|
403 |
INFO_PRINTF1(tempStore);
|
sl@0
|
404 |
|
sl@0
|
405 |
|
sl@0
|
406 |
// Compares parsed components from ini file.
|
sl@0
|
407 |
TPtrC iniParsed[] =
|
sl@0
|
408 |
{
|
sl@0
|
409 |
KParseDrive(),
|
sl@0
|
410 |
KParsePath(),
|
sl@0
|
411 |
KParseName(),
|
sl@0
|
412 |
KParseExt()
|
sl@0
|
413 |
};// size 4
|
sl@0
|
414 |
|
sl@0
|
415 |
TInt size = sizeof(iniParsed) / sizeof(TPtrC);
|
sl@0
|
416 |
for (TInt i = 0; i < size; i++)
|
sl@0
|
417 |
{
|
sl@0
|
418 |
// Reads components from ini
|
sl@0
|
419 |
TPtrC compareName;
|
sl@0
|
420 |
if (GET_OPTIONAL_STRING_PARAMETER(iniParsed[i], aSection, compareName))
|
sl@0
|
421 |
{
|
sl@0
|
422 |
if (parsedResult[i].CompareC(compareName, 0, NULL) != 0)
|
sl@0
|
423 |
{
|
sl@0
|
424 |
ERR_PRINTF3(_L("Error compare %S != %S"), &parsedResult[i], &compareName);
|
sl@0
|
425 |
SetBlockResult(EFail);
|
sl@0
|
426 |
}
|
sl@0
|
427 |
else
|
sl@0
|
428 |
{
|
sl@0
|
429 |
INFO_PRINTF3(_L("%S == %S"), &parsedResult[i], &compareName);
|
sl@0
|
430 |
}
|
sl@0
|
431 |
}
|
sl@0
|
432 |
}
|
sl@0
|
433 |
}
|
sl@0
|
434 |
}
|
sl@0
|
435 |
}
|
sl@0
|
436 |
|
sl@0
|
437 |
void CT_FsData::DoCmdMkDir(const TDesC& aSection)
|
sl@0
|
438 |
{
|
sl@0
|
439 |
// Gets name of directiry from ini file.
|
sl@0
|
440 |
TPtrC dir;
|
sl@0
|
441 |
if (GET_MANDATORY_STRING_PARAMETER(KDir(), aSection, dir))
|
sl@0
|
442 |
{
|
sl@0
|
443 |
// Makes a directory.
|
sl@0
|
444 |
TInt err = iFs->MkDir(dir);
|
sl@0
|
445 |
if (err != KErrNone)
|
sl@0
|
446 |
{
|
sl@0
|
447 |
ERR_PRINTF2(_L("MkDir error %d"), err);
|
sl@0
|
448 |
SetError(err);
|
sl@0
|
449 |
}
|
sl@0
|
450 |
}
|
sl@0
|
451 |
}
|
sl@0
|
452 |
|
sl@0
|
453 |
void CT_FsData::DoCmdMkDirAll(const TDesC& aSection)
|
sl@0
|
454 |
{
|
sl@0
|
455 |
// Gets name of directiry from ini file.
|
sl@0
|
456 |
TPtrC dir;
|
sl@0
|
457 |
if (GET_MANDATORY_STRING_PARAMETER(KDir(), aSection, dir))
|
sl@0
|
458 |
{
|
sl@0
|
459 |
// Makes one or more directories.
|
sl@0
|
460 |
TInt err = iFs->MkDirAll(dir);
|
sl@0
|
461 |
if (err != KErrNone)
|
sl@0
|
462 |
{
|
sl@0
|
463 |
ERR_PRINTF2(_L("MkDirAll error %d"), err);
|
sl@0
|
464 |
SetError(err);
|
sl@0
|
465 |
}
|
sl@0
|
466 |
}
|
sl@0
|
467 |
}
|
sl@0
|
468 |
|
sl@0
|
469 |
void CT_FsData::DoCmdRmDir(const TDesC& aSection)
|
sl@0
|
470 |
{
|
sl@0
|
471 |
// Gets name of directiry from ini file.
|
sl@0
|
472 |
TPtrC dir;
|
sl@0
|
473 |
if (GET_MANDATORY_STRING_PARAMETER(KDir(), aSection, dir))
|
sl@0
|
474 |
{
|
sl@0
|
475 |
// Removes a directory.
|
sl@0
|
476 |
TInt err = iFs->RmDir(dir);
|
sl@0
|
477 |
if (err != KErrNone)
|
sl@0
|
478 |
{
|
sl@0
|
479 |
ERR_PRINTF2(_L("RmDir error %d"), err);
|
sl@0
|
480 |
SetError(err);
|
sl@0
|
481 |
}
|
sl@0
|
482 |
}
|
sl@0
|
483 |
}
|
sl@0
|
484 |
|
sl@0
|
485 |
void CT_FsData::DoCmdGetDir(const TDesC& aSection)
|
sl@0
|
486 |
{
|
sl@0
|
487 |
TBool dataOk = ETrue;
|
sl@0
|
488 |
|
sl@0
|
489 |
// Reads name of directory from ini file.
|
sl@0
|
490 |
TPtrC name;
|
sl@0
|
491 |
if (!GET_MANDATORY_STRING_PARAMETER(KName(), aSection, name))
|
sl@0
|
492 |
{
|
sl@0
|
493 |
dataOk = EFalse;
|
sl@0
|
494 |
}
|
sl@0
|
495 |
|
sl@0
|
496 |
// Reads sort key from ini file.
|
sl@0
|
497 |
TPtrC entrySortKey;
|
sl@0
|
498 |
TUint sortKey = ESortByName;
|
sl@0
|
499 |
if (GET_MANDATORY_STRING_PARAMETER(KEntrySortKey(), aSection, entrySortKey))
|
sl@0
|
500 |
{
|
sl@0
|
501 |
if ( !ConvertToSortKey(entrySortKey, sortKey) )
|
sl@0
|
502 |
{
|
sl@0
|
503 |
TInt intTemp;
|
sl@0
|
504 |
if ( GET_MANDATORY_INT_PARAMETER(KEntrySortKey(), aSection, intTemp) )
|
sl@0
|
505 |
{
|
sl@0
|
506 |
sortKey=intTemp;
|
sl@0
|
507 |
}
|
sl@0
|
508 |
else
|
sl@0
|
509 |
{
|
sl@0
|
510 |
dataOk = EFalse;
|
sl@0
|
511 |
}
|
sl@0
|
512 |
}
|
sl@0
|
513 |
}
|
sl@0
|
514 |
else
|
sl@0
|
515 |
{
|
sl@0
|
516 |
dataOk = EFalse;
|
sl@0
|
517 |
}
|
sl@0
|
518 |
|
sl@0
|
519 |
// Reads attribute mask from ini file
|
sl@0
|
520 |
// if not exist
|
sl@0
|
521 |
// Reads uidtype from ini file
|
sl@0
|
522 |
|
sl@0
|
523 |
TInt intUIDType = 0;
|
sl@0
|
524 |
TUidType uidType = KNullUid;
|
sl@0
|
525 |
TBool isUidType = EFalse;
|
sl@0
|
526 |
|
sl@0
|
527 |
TUint attMask = KEntryAttNormal;
|
sl@0
|
528 |
|
sl@0
|
529 |
TBool isDirList = FALSE;
|
sl@0
|
530 |
|
sl@0
|
531 |
if (FileserverUtil::GetAttMask(*this, aSection, KAttMask(), attMask))
|
sl@0
|
532 |
{
|
sl@0
|
533 |
// Reads boolean of dirlist from ini file.
|
sl@0
|
534 |
GET_OPTIONAL_BOOL_PARAMETER(KIsDirList(), aSection, isDirList);
|
sl@0
|
535 |
}
|
sl@0
|
536 |
else if (GET_MANDATORY_INT_PARAMETER(KTUidType(), aSection, intUIDType))
|
sl@0
|
537 |
{
|
sl@0
|
538 |
TUid id = TUid::Uid(intUIDType);
|
sl@0
|
539 |
uidType = TUidType(id);
|
sl@0
|
540 |
INFO_PRINTF2(_L("UID type set to %d"), uidType[0].iUid);
|
sl@0
|
541 |
}
|
sl@0
|
542 |
else
|
sl@0
|
543 |
{
|
sl@0
|
544 |
dataOk = EFalse;
|
sl@0
|
545 |
ERR_PRINTF2(_L("attmask or %S must be declared !!!"), &KTUidType);
|
sl@0
|
546 |
}
|
sl@0
|
547 |
|
sl@0
|
548 |
// If all data was read
|
sl@0
|
549 |
if (dataOk)
|
sl@0
|
550 |
{
|
sl@0
|
551 |
// Gets a filtered list of a directory's contents.
|
sl@0
|
552 |
TInt err = KErrNone;
|
sl@0
|
553 |
CT_DirData* dirWrapperEntry = NULL;
|
sl@0
|
554 |
CT_DirData* dirWrapperDirectory = NULL;
|
sl@0
|
555 |
CDir* entryArray = NULL;
|
sl@0
|
556 |
CDir* dirArray = NULL;
|
sl@0
|
557 |
TPtrC dirEntryArray;
|
sl@0
|
558 |
TPtrC dirDirectoryArray;
|
sl@0
|
559 |
|
sl@0
|
560 |
if (GET_OPTIONAL_STRING_PARAMETER(KDirEntryArray(), aSection, dirEntryArray))
|
sl@0
|
561 |
{
|
sl@0
|
562 |
TRAP(err, dirWrapperEntry = static_cast<CT_DirData*>(GetDataWrapperL(dirEntryArray)));
|
sl@0
|
563 |
}
|
sl@0
|
564 |
|
sl@0
|
565 |
if (GET_OPTIONAL_STRING_PARAMETER(KDirDirectoryArray(), aSection, dirDirectoryArray))
|
sl@0
|
566 |
{
|
sl@0
|
567 |
TRAP(err, dirWrapperDirectory = static_cast<CT_DirData*>(GetDataWrapperL(dirDirectoryArray)));
|
sl@0
|
568 |
}
|
sl@0
|
569 |
|
sl@0
|
570 |
if (isUidType)
|
sl@0
|
571 |
{
|
sl@0
|
572 |
// Gets a filtered list of a directory's contents by UID type.
|
sl@0
|
573 |
err = iFs->GetDir(name, uidType, sortKey, entryArray);
|
sl@0
|
574 |
}
|
sl@0
|
575 |
else
|
sl@0
|
576 |
{
|
sl@0
|
577 |
if (isDirList)
|
sl@0
|
578 |
{
|
sl@0
|
579 |
// Gets a filtered list of the directory and file entries contained in a directory,
|
sl@0
|
580 |
// and a list of the directory entries only.
|
sl@0
|
581 |
err = iFs->GetDir(name, attMask, sortKey, entryArray, dirArray);
|
sl@0
|
582 |
}
|
sl@0
|
583 |
else
|
sl@0
|
584 |
{
|
sl@0
|
585 |
// Gets a filtered list of a directory's contents.
|
sl@0
|
586 |
err = iFs->GetDir(name, attMask, sortKey, entryArray);
|
sl@0
|
587 |
}
|
sl@0
|
588 |
}
|
sl@0
|
589 |
|
sl@0
|
590 |
if (err != KErrNone)
|
sl@0
|
591 |
{
|
sl@0
|
592 |
ERR_PRINTF2(_L("GetDir error %d"), err);
|
sl@0
|
593 |
SetError(err);
|
sl@0
|
594 |
}
|
sl@0
|
595 |
else
|
sl@0
|
596 |
{
|
sl@0
|
597 |
// Writes sorted entries to log file.
|
sl@0
|
598 |
INFO_PRINTF2(_L("PATH %S"), &name);
|
sl@0
|
599 |
for (TInt i = 0; i < entryArray->Count(); i++)
|
sl@0
|
600 |
{
|
sl@0
|
601 |
TBuf<KMaxTestExecuteCommandLength> tempStore;
|
sl@0
|
602 |
tempStore.Format(_L("%d) %S"), i+1, &(*entryArray)[i].iName);
|
sl@0
|
603 |
INFO_PRINTF1(tempStore);
|
sl@0
|
604 |
}
|
sl@0
|
605 |
|
sl@0
|
606 |
// If "_comparename" of parameter is set in INI file, then
|
sl@0
|
607 |
// try to find this name in the list of entries.
|
sl@0
|
608 |
TPtrC compareName;
|
sl@0
|
609 |
if (GET_OPTIONAL_STRING_PARAMETER(KCompareName(), aSection, compareName))
|
sl@0
|
610 |
{
|
sl@0
|
611 |
// Find compare name in list of entries.
|
sl@0
|
612 |
TBool isFind = FALSE;
|
sl@0
|
613 |
for (TInt i = 0; i < entryArray->Count(); i++)
|
sl@0
|
614 |
{
|
sl@0
|
615 |
if (compareName.CompareC((*entryArray)[i].iName, 0, NULL) == 0)
|
sl@0
|
616 |
{
|
sl@0
|
617 |
isFind = TRUE;
|
sl@0
|
618 |
}
|
sl@0
|
619 |
}
|
sl@0
|
620 |
|
sl@0
|
621 |
// Reads a flag which specifies a name should be existing or not be existing
|
sl@0
|
622 |
// specified in parameter "KCompareName".
|
sl@0
|
623 |
TBool isExist = TRUE;
|
sl@0
|
624 |
GET_OPTIONAL_BOOL_PARAMETER(KIsExist(), aSection, isExist);
|
sl@0
|
625 |
|
sl@0
|
626 |
TPtrC strIsExist = isExist ? _L("EXIST") : _L("NOT EXIST");
|
sl@0
|
627 |
INFO_PRINTF3(_L("%S must be %S"), &compareName, &strIsExist);
|
sl@0
|
628 |
|
sl@0
|
629 |
TPtrC strIsFind = isFind ? _L("FOUND") : _L("NOT FOUND");
|
sl@0
|
630 |
INFO_PRINTF3(_L("%S is %S"), &compareName, &strIsFind);
|
sl@0
|
631 |
|
sl@0
|
632 |
// If name has been found when this name must not be existing
|
sl@0
|
633 |
// or when name has been not found when name must be existing
|
sl@0
|
634 |
// then test case fail.
|
sl@0
|
635 |
if (isExist != isFind)
|
sl@0
|
636 |
{
|
sl@0
|
637 |
ERR_PRINTF1(_L("Expected exist does not match actual"));
|
sl@0
|
638 |
SetBlockResult(EFail);
|
sl@0
|
639 |
}
|
sl@0
|
640 |
}
|
sl@0
|
641 |
}
|
sl@0
|
642 |
|
sl@0
|
643 |
// Delete list of data
|
sl@0
|
644 |
if (entryArray)
|
sl@0
|
645 |
{
|
sl@0
|
646 |
if(dirWrapperEntry)
|
sl@0
|
647 |
{
|
sl@0
|
648 |
dirWrapperEntry->SetObjectL(entryArray);
|
sl@0
|
649 |
}
|
sl@0
|
650 |
else
|
sl@0
|
651 |
{
|
sl@0
|
652 |
delete entryArray;
|
sl@0
|
653 |
entryArray = NULL;
|
sl@0
|
654 |
}
|
sl@0
|
655 |
}
|
sl@0
|
656 |
if (dirArray)
|
sl@0
|
657 |
{
|
sl@0
|
658 |
if(dirWrapperDirectory)
|
sl@0
|
659 |
{
|
sl@0
|
660 |
dirWrapperDirectory->SetObjectL(dirArray);
|
sl@0
|
661 |
}
|
sl@0
|
662 |
else
|
sl@0
|
663 |
{
|
sl@0
|
664 |
delete dirArray;
|
sl@0
|
665 |
dirArray = NULL;
|
sl@0
|
666 |
}
|
sl@0
|
667 |
}
|
sl@0
|
668 |
}
|
sl@0
|
669 |
}
|
sl@0
|
670 |
|
sl@0
|
671 |
void CT_FsData::DoCmdDelete(const TDesC& aSection)
|
sl@0
|
672 |
{
|
sl@0
|
673 |
// Reads name of file from ini file.
|
sl@0
|
674 |
TPtrC name;
|
sl@0
|
675 |
if (GET_MANDATORY_STRING_PARAMETER(KName(), aSection, name))
|
sl@0
|
676 |
{
|
sl@0
|
677 |
// Deletes a single file.
|
sl@0
|
678 |
TInt err = iFs->Delete(name);
|
sl@0
|
679 |
if (err != KErrNone)
|
sl@0
|
680 |
{
|
sl@0
|
681 |
ERR_PRINTF2(_L("Delete error %d"), err);
|
sl@0
|
682 |
SetError(err);
|
sl@0
|
683 |
}
|
sl@0
|
684 |
}
|
sl@0
|
685 |
}
|
sl@0
|
686 |
|
sl@0
|
687 |
void CT_FsData::DoCmdRename(const TDesC& aSection)
|
sl@0
|
688 |
{
|
sl@0
|
689 |
TBool dataOk=ETrue;
|
sl@0
|
690 |
|
sl@0
|
691 |
// Reads the old name of file or directory from ini file.
|
sl@0
|
692 |
TPtrC oldName;
|
sl@0
|
693 |
if ( !GET_MANDATORY_STRING_PARAMETER(KOldName(), aSection, oldName) )
|
sl@0
|
694 |
{
|
sl@0
|
695 |
dataOk=EFalse;
|
sl@0
|
696 |
}
|
sl@0
|
697 |
|
sl@0
|
698 |
// Reads the new name of file or directory from ini file.
|
sl@0
|
699 |
TPtrC newName;
|
sl@0
|
700 |
if ( !GET_MANDATORY_STRING_PARAMETER(KNewName(), aSection, newName) )
|
sl@0
|
701 |
{
|
sl@0
|
702 |
dataOk=EFalse;
|
sl@0
|
703 |
}
|
sl@0
|
704 |
|
sl@0
|
705 |
if ( dataOk )
|
sl@0
|
706 |
{
|
sl@0
|
707 |
// Renames a single file or directory.
|
sl@0
|
708 |
TInt err = iFs->Rename(oldName, newName);
|
sl@0
|
709 |
if (err != KErrNone)
|
sl@0
|
710 |
{
|
sl@0
|
711 |
ERR_PRINTF2(_L("Rename error %d"), err);
|
sl@0
|
712 |
SetError(err);
|
sl@0
|
713 |
}
|
sl@0
|
714 |
else
|
sl@0
|
715 |
{
|
sl@0
|
716 |
INFO_PRINTF3(_L("File %S was renamed to %S successfully"), &oldName, &newName);
|
sl@0
|
717 |
}
|
sl@0
|
718 |
}
|
sl@0
|
719 |
}
|
sl@0
|
720 |
|
sl@0
|
721 |
void CT_FsData::DoCmdReplace(const TDesC& aSection)
|
sl@0
|
722 |
{
|
sl@0
|
723 |
TBool dataOk=ETrue;
|
sl@0
|
724 |
|
sl@0
|
725 |
// Reads the old name of file from ini file.
|
sl@0
|
726 |
TPtrC oldName;
|
sl@0
|
727 |
if ( !GET_MANDATORY_STRING_PARAMETER(KOldName(), aSection, oldName) )
|
sl@0
|
728 |
{
|
sl@0
|
729 |
dataOk=EFalse;
|
sl@0
|
730 |
}
|
sl@0
|
731 |
|
sl@0
|
732 |
// Reads the new name of file from ini file.
|
sl@0
|
733 |
TPtrC newName;
|
sl@0
|
734 |
if ( !GET_MANDATORY_STRING_PARAMETER(KNewName(), aSection, newName) )
|
sl@0
|
735 |
{
|
sl@0
|
736 |
dataOk=EFalse;
|
sl@0
|
737 |
}
|
sl@0
|
738 |
|
sl@0
|
739 |
if ( dataOk )
|
sl@0
|
740 |
{
|
sl@0
|
741 |
// Replaces a single file with another.
|
sl@0
|
742 |
TInt err = iFs->Replace(oldName, newName);
|
sl@0
|
743 |
if (err != KErrNone)
|
sl@0
|
744 |
{
|
sl@0
|
745 |
ERR_PRINTF2(_L("Replace error %d"), err);
|
sl@0
|
746 |
SetError(err);
|
sl@0
|
747 |
}
|
sl@0
|
748 |
else
|
sl@0
|
749 |
{
|
sl@0
|
750 |
INFO_PRINTF3(_L("File %S was replaced to %S successfully"), &oldName, &newName);
|
sl@0
|
751 |
}
|
sl@0
|
752 |
}
|
sl@0
|
753 |
}
|
sl@0
|
754 |
|
sl@0
|
755 |
void CT_FsData::DoCmdAtt(const TDesC& aSection)
|
sl@0
|
756 |
{
|
sl@0
|
757 |
// Reads the name of file from ini file.
|
sl@0
|
758 |
TPtrC name;
|
sl@0
|
759 |
if (GET_MANDATORY_STRING_PARAMETER(KName(), aSection, name))
|
sl@0
|
760 |
{
|
sl@0
|
761 |
// Gets a file's attributes.
|
sl@0
|
762 |
TUint attValue;
|
sl@0
|
763 |
TInt err = iFs->Att(name, attValue);
|
sl@0
|
764 |
INFO_PRINTF2(_L("RFs::Att = 0x%X"), attValue);
|
sl@0
|
765 |
if (err != KErrNone)
|
sl@0
|
766 |
{
|
sl@0
|
767 |
ERR_PRINTF2(_L("Att error %d"), err);
|
sl@0
|
768 |
SetError(err);
|
sl@0
|
769 |
}
|
sl@0
|
770 |
else
|
sl@0
|
771 |
{
|
sl@0
|
772 |
TUint arrAttMask[]=
|
sl@0
|
773 |
{
|
sl@0
|
774 |
KEntryAttReadOnly,
|
sl@0
|
775 |
KEntryAttHidden,
|
sl@0
|
776 |
KEntryAttSystem,
|
sl@0
|
777 |
KEntryAttVolume,
|
sl@0
|
778 |
KEntryAttDir,
|
sl@0
|
779 |
KEntryAttArchive,
|
sl@0
|
780 |
KEntryAttXIP
|
sl@0
|
781 |
};//size 7
|
sl@0
|
782 |
|
sl@0
|
783 |
// Writes what attributes has a file.
|
sl@0
|
784 |
INFO_PRINTF1(_L("--- START --- print all attributes"));
|
sl@0
|
785 |
|
sl@0
|
786 |
TInt size = sizeof(arrAttMask) / sizeof(TUint);
|
sl@0
|
787 |
for (TInt i = 0; i < size; i++)
|
sl@0
|
788 |
{
|
sl@0
|
789 |
if (attValue & arrAttMask[i])
|
sl@0
|
790 |
{
|
sl@0
|
791 |
INFO_PRINTF2(_L("Attribute %S is set"), &ConvertToStrAttMask(arrAttMask[i]));
|
sl@0
|
792 |
}
|
sl@0
|
793 |
else
|
sl@0
|
794 |
{
|
sl@0
|
795 |
INFO_PRINTF2(_L("Attribute %S is not set"), &ConvertToStrAttMask(arrAttMask[i]));
|
sl@0
|
796 |
}
|
sl@0
|
797 |
}
|
sl@0
|
798 |
INFO_PRINTF1(_L("--- END --- print all attributes"));
|
sl@0
|
799 |
|
sl@0
|
800 |
// Reads atribute wich is testing.
|
sl@0
|
801 |
TPtrC testAttMaskStr;
|
sl@0
|
802 |
if(GET_OPTIONAL_STRING_PARAMETER(KEntrySetAttMask(), aSection, testAttMaskStr))
|
sl@0
|
803 |
{
|
sl@0
|
804 |
TUint testAttMask = 0;
|
sl@0
|
805 |
if (FileserverUtil::GetAttMask(*this, aSection, KEntrySetAttMask(), testAttMask))
|
sl@0
|
806 |
{
|
sl@0
|
807 |
// Reads a flag which specifies a attribute should be set or not set
|
sl@0
|
808 |
// specified in parameter "KEntrySetAttMask".
|
sl@0
|
809 |
TBool testIsSet = TRUE;
|
sl@0
|
810 |
if (GET_OPTIONAL_BOOL_PARAMETER(KIsSetAtt(), aSection, testIsSet))
|
sl@0
|
811 |
{
|
sl@0
|
812 |
INFO_PRINTF2(_L("TEST attributes %S must be set"), &ConvertToStrAttMask(testAttMask));
|
sl@0
|
813 |
}
|
sl@0
|
814 |
else
|
sl@0
|
815 |
{
|
sl@0
|
816 |
INFO_PRINTF2(_L("TEST attributes %S must not be set"), &ConvertToStrAttMask(testAttMask));
|
sl@0
|
817 |
}
|
sl@0
|
818 |
if ( (attValue&testAttMask)==testAttMask )
|
sl@0
|
819 |
{
|
sl@0
|
820 |
if ( !testIsSet )
|
sl@0
|
821 |
{
|
sl@0
|
822 |
ERR_PRINTF2(_L("All bits not set %S"), &ConvertToStrAttMask(testAttMask));
|
sl@0
|
823 |
SetBlockResult(EFail);
|
sl@0
|
824 |
}
|
sl@0
|
825 |
}
|
sl@0
|
826 |
else if ( (attValue&testAttMask)==0 )
|
sl@0
|
827 |
{
|
sl@0
|
828 |
if ( testIsSet )
|
sl@0
|
829 |
{
|
sl@0
|
830 |
ERR_PRINTF2(_L("Some bits set %S"), &ConvertToStrAttMask(testAttMask));
|
sl@0
|
831 |
SetBlockResult(EFail);
|
sl@0
|
832 |
}
|
sl@0
|
833 |
}
|
sl@0
|
834 |
else
|
sl@0
|
835 |
{
|
sl@0
|
836 |
ERR_PRINTF2(_L("Some bits set %S"), &ConvertToStrAttMask(testAttMask));
|
sl@0
|
837 |
SetBlockResult(EFail);
|
sl@0
|
838 |
}
|
sl@0
|
839 |
}
|
sl@0
|
840 |
else
|
sl@0
|
841 |
{
|
sl@0
|
842 |
ERR_PRINTF1(_L("Unknown attribute!"));
|
sl@0
|
843 |
SetBlockResult(EFail);
|
sl@0
|
844 |
}
|
sl@0
|
845 |
}
|
sl@0
|
846 |
}
|
sl@0
|
847 |
}
|
sl@0
|
848 |
}
|
sl@0
|
849 |
|
sl@0
|
850 |
void CT_FsData::DoCmdSetAtt(const TDesC& aSection)
|
sl@0
|
851 |
{
|
sl@0
|
852 |
// Reads attributes to be set from ini file.
|
sl@0
|
853 |
TUint setAttMask = 0;
|
sl@0
|
854 |
|
sl@0
|
855 |
if (!FileserverUtil::GetAttMask(*this, aSection, KEntrySetAttMask(), setAttMask))
|
sl@0
|
856 |
{
|
sl@0
|
857 |
ERR_PRINTF1(_L("Unknown attribute!"));
|
sl@0
|
858 |
SetBlockResult(EFail);
|
sl@0
|
859 |
}
|
sl@0
|
860 |
|
sl@0
|
861 |
// Reads attributes to be clear from ini file.
|
sl@0
|
862 |
TUint clearAttMask = 0;
|
sl@0
|
863 |
if (!FileserverUtil::GetAttMask(*this, aSection, KEntryClearAttMask(), clearAttMask))
|
sl@0
|
864 |
{
|
sl@0
|
865 |
ERR_PRINTF1(_L("Unknown attribute!"));
|
sl@0
|
866 |
SetBlockResult(EFail);
|
sl@0
|
867 |
}
|
sl@0
|
868 |
|
sl@0
|
869 |
// Reads the name of file or directory from ini file.
|
sl@0
|
870 |
TPtrC name;
|
sl@0
|
871 |
if (GET_MANDATORY_STRING_PARAMETER(KName(), aSection, name))
|
sl@0
|
872 |
{
|
sl@0
|
873 |
// Sets or clears the attributes of a single file or directory.
|
sl@0
|
874 |
TInt err = iFs->SetAtt(name, setAttMask, clearAttMask);
|
sl@0
|
875 |
if (err != KErrNone)
|
sl@0
|
876 |
{
|
sl@0
|
877 |
ERR_PRINTF2(_L("SetAtt error %d"), err);
|
sl@0
|
878 |
SetError(err);
|
sl@0
|
879 |
}
|
sl@0
|
880 |
else
|
sl@0
|
881 |
{
|
sl@0
|
882 |
INFO_PRINTF1(_L("SetAtt() is successful"));
|
sl@0
|
883 |
}
|
sl@0
|
884 |
}
|
sl@0
|
885 |
}
|
sl@0
|
886 |
|
sl@0
|
887 |
void CT_FsData::DoCmdModified(const TDesC& aSection)
|
sl@0
|
888 |
{
|
sl@0
|
889 |
// Reads the name of file or directory from ini file.
|
sl@0
|
890 |
TPtrC name;
|
sl@0
|
891 |
if (GET_MANDATORY_STRING_PARAMETER(KName(), aSection, name))
|
sl@0
|
892 |
{
|
sl@0
|
893 |
// Gets the last modification date and time of a file or a directory, in UTC.
|
sl@0
|
894 |
TTime time;
|
sl@0
|
895 |
TInt err = iFs->Modified(name, time);
|
sl@0
|
896 |
if (err != KErrNone)
|
sl@0
|
897 |
{
|
sl@0
|
898 |
ERR_PRINTF2(_L("Modified error %d"), err);
|
sl@0
|
899 |
SetError(err);
|
sl@0
|
900 |
}
|
sl@0
|
901 |
else
|
sl@0
|
902 |
{
|
sl@0
|
903 |
// Write to log modified date and time.
|
sl@0
|
904 |
TBuf<KTimeFormatSize> dateString;
|
sl@0
|
905 |
TRAP (err, time.FormatL(dateString, KTimeFormat));
|
sl@0
|
906 |
if (err != KErrNone)
|
sl@0
|
907 |
{
|
sl@0
|
908 |
ERR_PRINTF2(_L("time.FormatL() error %d"), err);
|
sl@0
|
909 |
SetBlockResult(EFail);
|
sl@0
|
910 |
}
|
sl@0
|
911 |
else
|
sl@0
|
912 |
{
|
sl@0
|
913 |
INFO_PRINTF3(_L("File %S modified: %S"), &name, &dateString);
|
sl@0
|
914 |
|
sl@0
|
915 |
// Reads time in ini file which must be returned from function "Modified()".
|
sl@0
|
916 |
TPtrC inputTime;
|
sl@0
|
917 |
if (GET_OPTIONAL_STRING_PARAMETER(KTime(), aSection, inputTime))
|
sl@0
|
918 |
{
|
sl@0
|
919 |
// Convert input string in "KTime" from ini to TTime object.
|
sl@0
|
920 |
// Assigns a date and time contained in a descriptor.
|
sl@0
|
921 |
TTime iniTime;
|
sl@0
|
922 |
TInt err = iniTime.Set(inputTime);
|
sl@0
|
923 |
if (err == KErrNone)
|
sl@0
|
924 |
{
|
sl@0
|
925 |
// Compares time from ini file and time returned from function.
|
sl@0
|
926 |
if (iniTime == time)
|
sl@0
|
927 |
{
|
sl@0
|
928 |
INFO_PRINTF1(_L("Time equal"));
|
sl@0
|
929 |
}
|
sl@0
|
930 |
else
|
sl@0
|
931 |
{
|
sl@0
|
932 |
ERR_PRINTF3(_L("Time not equal, %S != %S"), &inputTime, &dateString);
|
sl@0
|
933 |
SetBlockResult(EFail);
|
sl@0
|
934 |
}
|
sl@0
|
935 |
}
|
sl@0
|
936 |
else
|
sl@0
|
937 |
{
|
sl@0
|
938 |
ERR_PRINTF2(_L("Fail set time, error %d"), err);
|
sl@0
|
939 |
SetBlockResult(EFail);
|
sl@0
|
940 |
}
|
sl@0
|
941 |
}
|
sl@0
|
942 |
}
|
sl@0
|
943 |
}
|
sl@0
|
944 |
}
|
sl@0
|
945 |
}
|
sl@0
|
946 |
|
sl@0
|
947 |
void CT_FsData::DoCmdSetModified(const TDesC& aSection)
|
sl@0
|
948 |
{
|
sl@0
|
949 |
// Reads the time from ini file.
|
sl@0
|
950 |
TTime time(0);
|
sl@0
|
951 |
TPtrC inputTime;
|
sl@0
|
952 |
if (GET_OPTIONAL_STRING_PARAMETER(KTime(), aSection, inputTime))
|
sl@0
|
953 |
{
|
sl@0
|
954 |
// Assigns a date and time contained in a descriptor.
|
sl@0
|
955 |
TInt err = time.Set(inputTime);
|
sl@0
|
956 |
if (err != KErrNone)
|
sl@0
|
957 |
{
|
sl@0
|
958 |
ERR_PRINTF2(_L("Time set failed, error %d"), err);
|
sl@0
|
959 |
SetBlockResult(EFail);
|
sl@0
|
960 |
}
|
sl@0
|
961 |
}
|
sl@0
|
962 |
|
sl@0
|
963 |
// Reads the name of file or directory from ini file.
|
sl@0
|
964 |
TPtrC name;
|
sl@0
|
965 |
if (GET_MANDATORY_STRING_PARAMETER(KName(), aSection, name))
|
sl@0
|
966 |
{
|
sl@0
|
967 |
// Sets the date and time that the contents of a file or directory were modified, in UTC.
|
sl@0
|
968 |
TInt err = iFs->SetModified(name, time);
|
sl@0
|
969 |
if (err != KErrNone)
|
sl@0
|
970 |
{
|
sl@0
|
971 |
ERR_PRINTF2(_L("SetModified error %d"), err);
|
sl@0
|
972 |
SetError(err);
|
sl@0
|
973 |
}
|
sl@0
|
974 |
else
|
sl@0
|
975 |
{
|
sl@0
|
976 |
INFO_PRINTF1(_L("SetModified() OK"));
|
sl@0
|
977 |
}
|
sl@0
|
978 |
}
|
sl@0
|
979 |
}
|
sl@0
|
980 |
|
sl@0
|
981 |
void CT_FsData::DoCmdEntryL(const TDesC& aSection)
|
sl@0
|
982 |
{
|
sl@0
|
983 |
TBool isEntryNew = EFalse;
|
sl@0
|
984 |
|
sl@0
|
985 |
// Reads the name of file or directory from ini file.
|
sl@0
|
986 |
TPtrC name;
|
sl@0
|
987 |
if (GET_MANDATORY_STRING_PARAMETER(KName(), aSection, name))
|
sl@0
|
988 |
{
|
sl@0
|
989 |
TEntry *entry = NULL;
|
sl@0
|
990 |
|
sl@0
|
991 |
// Gets the entry details for a file or directory.
|
sl@0
|
992 |
TPtrC entryObjectName;
|
sl@0
|
993 |
if( GET_OPTIONAL_STRING_PARAMETER( KObjectEntry, aSection, entryObjectName ) )
|
sl@0
|
994 |
{
|
sl@0
|
995 |
INFO_PRINTF1( _L( "Get TEntry class instance." ) );
|
sl@0
|
996 |
TRAPD( err, entry = (TEntry*)GetDataObjectL(entryObjectName));
|
sl@0
|
997 |
if ( err != KErrNone )
|
sl@0
|
998 |
{
|
sl@0
|
999 |
ERR_PRINTF3( _L( "Unrecognized object name parameter value: %S. Error %d"), &entryObjectName, err );
|
sl@0
|
1000 |
SetBlockResult(EFail);
|
sl@0
|
1001 |
}
|
sl@0
|
1002 |
else
|
sl@0
|
1003 |
{
|
sl@0
|
1004 |
INFO_PRINTF1( _L( "TEntry class instance accepted OK." ) );
|
sl@0
|
1005 |
}
|
sl@0
|
1006 |
}
|
sl@0
|
1007 |
else
|
sl@0
|
1008 |
{
|
sl@0
|
1009 |
INFO_PRINTF1( _L( "Create new temporary TEntry() class instance." ) );
|
sl@0
|
1010 |
TRAPD( err, entry = new (ELeave) TEntry() );
|
sl@0
|
1011 |
if ( err!=KErrNone )
|
sl@0
|
1012 |
{
|
sl@0
|
1013 |
ERR_PRINTF2( _L( "new TEntry() error %d" ), err );
|
sl@0
|
1014 |
SetBlockResult(EFail);
|
sl@0
|
1015 |
}
|
sl@0
|
1016 |
else
|
sl@0
|
1017 |
{
|
sl@0
|
1018 |
isEntryNew = ETrue;
|
sl@0
|
1019 |
}
|
sl@0
|
1020 |
}
|
sl@0
|
1021 |
|
sl@0
|
1022 |
if ( entry != NULL )
|
sl@0
|
1023 |
{
|
sl@0
|
1024 |
TInt err = iFs->Entry(name, *entry);
|
sl@0
|
1025 |
if (err != KErrNone)
|
sl@0
|
1026 |
{
|
sl@0
|
1027 |
ERR_PRINTF2(_L("Entry error %d"), err);
|
sl@0
|
1028 |
SetError(err);
|
sl@0
|
1029 |
}
|
sl@0
|
1030 |
else
|
sl@0
|
1031 |
{
|
sl@0
|
1032 |
// Prints all entry details for the file or directory.
|
sl@0
|
1033 |
// and compares these entry fith entry in ini file
|
sl@0
|
1034 |
TPtrC arrNames[] =
|
sl@0
|
1035 |
{
|
sl@0
|
1036 |
KEntryAttDirStr(),
|
sl@0
|
1037 |
KEntryAttArchiveStr(),
|
sl@0
|
1038 |
KEntryAttHiddenStr(),
|
sl@0
|
1039 |
KEntryAttReadOnlyStr(),
|
sl@0
|
1040 |
KEntryAttSystemStr(),
|
sl@0
|
1041 |
KEntryAttAllowUidStr()
|
sl@0
|
1042 |
};//size 6
|
sl@0
|
1043 |
|
sl@0
|
1044 |
TInt64 arrFunctions[] =
|
sl@0
|
1045 |
{
|
sl@0
|
1046 |
entry->IsDir() > 0,
|
sl@0
|
1047 |
entry->IsArchive() > 0,
|
sl@0
|
1048 |
entry->IsHidden() > 0,
|
sl@0
|
1049 |
entry->IsReadOnly() > 0,
|
sl@0
|
1050 |
entry->IsSystem() > 0,
|
sl@0
|
1051 |
entry->IsTypeValid() > 0
|
sl@0
|
1052 |
};//size 6
|
sl@0
|
1053 |
|
sl@0
|
1054 |
TPtrC iniParam[] =
|
sl@0
|
1055 |
{
|
sl@0
|
1056 |
KIsAttDir(),
|
sl@0
|
1057 |
KIsAttArchive(),
|
sl@0
|
1058 |
KIsAttHidden(),
|
sl@0
|
1059 |
KIsAttReadOnly(),
|
sl@0
|
1060 |
KIsAttSystem(),
|
sl@0
|
1061 |
KIsAttAllowUid(),
|
sl@0
|
1062 |
};//size 6
|
sl@0
|
1063 |
|
sl@0
|
1064 |
TInt size = sizeof(arrNames) / sizeof(TPtrC);
|
sl@0
|
1065 |
for (TInt i = 0; i < size; i++)
|
sl@0
|
1066 |
{
|
sl@0
|
1067 |
TBuf<KMaxTestExecuteCommandLength> tempStore;
|
sl@0
|
1068 |
if (arrFunctions[i])
|
sl@0
|
1069 |
{
|
sl@0
|
1070 |
tempStore.Format(_L("%S - attribute %S is SET"), &name, &arrNames[i]);
|
sl@0
|
1071 |
}
|
sl@0
|
1072 |
else
|
sl@0
|
1073 |
{
|
sl@0
|
1074 |
tempStore.Format(_L("%S - attribute %S is NOT SET"), &name, &arrNames[i]);
|
sl@0
|
1075 |
}
|
sl@0
|
1076 |
INFO_PRINTF1(tempStore);
|
sl@0
|
1077 |
|
sl@0
|
1078 |
// If iniParam[] is set in ini then compare with attribute returned from function.
|
sl@0
|
1079 |
TBool iniCompare = FALSE;
|
sl@0
|
1080 |
if (GET_OPTIONAL_BOOL_PARAMETER(iniParam[i], aSection, iniCompare))
|
sl@0
|
1081 |
{
|
sl@0
|
1082 |
// Compares entry in ini file and entry returned from function.
|
sl@0
|
1083 |
if (arrFunctions[i] != iniCompare)
|
sl@0
|
1084 |
{
|
sl@0
|
1085 |
ERR_PRINTF2(_L("Error compare attribute %S"), &iniParam[i]);
|
sl@0
|
1086 |
SetBlockResult(EFail);
|
sl@0
|
1087 |
}
|
sl@0
|
1088 |
}
|
sl@0
|
1089 |
}
|
sl@0
|
1090 |
|
sl@0
|
1091 |
// Prints size of file.
|
sl@0
|
1092 |
INFO_PRINTF3(_L("%S - size %d"), &name, entry->iSize);
|
sl@0
|
1093 |
|
sl@0
|
1094 |
// Compare size of file returned from function with size from ini.
|
sl@0
|
1095 |
TInt iniSize = 0;
|
sl@0
|
1096 |
if (GET_OPTIONAL_INT_PARAMETER(KSize(), aSection, iniSize))
|
sl@0
|
1097 |
{
|
sl@0
|
1098 |
if (entry->iSize != iniSize)
|
sl@0
|
1099 |
{
|
sl@0
|
1100 |
ERR_PRINTF3(_L("Size from ini file not equal with size returned from function (%d != %d)"), iniSize, entry->iSize);
|
sl@0
|
1101 |
SetBlockResult(EFail);
|
sl@0
|
1102 |
}
|
sl@0
|
1103 |
}
|
sl@0
|
1104 |
|
sl@0
|
1105 |
// Prints the system time of last modification.
|
sl@0
|
1106 |
TBuf<KTimeFormatSize> dateString;
|
sl@0
|
1107 |
entry->iModified.FormatL(dateString, KTimeFormat);
|
sl@0
|
1108 |
INFO_PRINTF3(_L("%S - modified %S"), &name, &dateString);
|
sl@0
|
1109 |
|
sl@0
|
1110 |
// Compare time from ini with time returned from function.
|
sl@0
|
1111 |
TPtrC iniTimeStr;
|
sl@0
|
1112 |
if (GET_OPTIONAL_STRING_PARAMETER(KTime(), aSection, iniTimeStr))
|
sl@0
|
1113 |
{
|
sl@0
|
1114 |
// Assigns a date and time contained in a descriptor.
|
sl@0
|
1115 |
TTime iniTime;
|
sl@0
|
1116 |
|
sl@0
|
1117 |
TInt error = iniTime.Set(iniTimeStr);
|
sl@0
|
1118 |
if(error == KErrNone)
|
sl@0
|
1119 |
{
|
sl@0
|
1120 |
// Compares size in ini file and size returned from function.
|
sl@0
|
1121 |
if (entry->iModified != iniTime)
|
sl@0
|
1122 |
{
|
sl@0
|
1123 |
ERR_PRINTF1(_L("Time from ini file not equal with time returned from function."));
|
sl@0
|
1124 |
SetBlockResult(EFail);
|
sl@0
|
1125 |
}
|
sl@0
|
1126 |
}
|
sl@0
|
1127 |
else
|
sl@0
|
1128 |
{
|
sl@0
|
1129 |
ERR_PRINTF3(_L("Cannot convert %S to TTime type. Error: %d"), &iniTimeStr, error);
|
sl@0
|
1130 |
SetBlockResult(EFail);
|
sl@0
|
1131 |
}
|
sl@0
|
1132 |
}
|
sl@0
|
1133 |
|
sl@0
|
1134 |
// Prints the file's UIDtype.
|
sl@0
|
1135 |
INFO_PRINTF3(_L("%S - UIDtype %d"), &name, entry->MostDerivedUid().iUid);
|
sl@0
|
1136 |
|
sl@0
|
1137 |
if (isEntryNew)
|
sl@0
|
1138 |
{
|
sl@0
|
1139 |
INFO_PRINTF1(_L("Delete temporary TEntry() class instance."));
|
sl@0
|
1140 |
delete entry;
|
sl@0
|
1141 |
entry = NULL;
|
sl@0
|
1142 |
}
|
sl@0
|
1143 |
}
|
sl@0
|
1144 |
}
|
sl@0
|
1145 |
}
|
sl@0
|
1146 |
}
|
sl@0
|
1147 |
|
sl@0
|
1148 |
void CT_FsData::DoCmdSetEntry(const TDesC& aSection)
|
sl@0
|
1149 |
{
|
sl@0
|
1150 |
TBool dataOk=ETrue;
|
sl@0
|
1151 |
|
sl@0
|
1152 |
TUint setAttMask = 0;
|
sl@0
|
1153 |
if (!FileserverUtil::GetAttMask(*this, aSection, KEntrySetAttMask(), setAttMask))
|
sl@0
|
1154 |
{
|
sl@0
|
1155 |
dataOk = EFalse;
|
sl@0
|
1156 |
ERR_PRINTF1(_L("Unknown attribute!"));
|
sl@0
|
1157 |
SetBlockResult(EFail);
|
sl@0
|
1158 |
}
|
sl@0
|
1159 |
|
sl@0
|
1160 |
// Reads attributes to be clear from ini file.
|
sl@0
|
1161 |
TUint clearAttMask = 0;
|
sl@0
|
1162 |
if (!FileserverUtil::GetAttMask(*this, aSection, KEntryClearAttMask(), clearAttMask))
|
sl@0
|
1163 |
{
|
sl@0
|
1164 |
dataOk = EFalse;
|
sl@0
|
1165 |
ERR_PRINTF1(_L("Unknown attribute!"));
|
sl@0
|
1166 |
SetBlockResult(EFail);
|
sl@0
|
1167 |
}
|
sl@0
|
1168 |
// Reads the time from ini file.
|
sl@0
|
1169 |
TTime time(0);
|
sl@0
|
1170 |
TPtrC inputTime;
|
sl@0
|
1171 |
if (GET_OPTIONAL_STRING_PARAMETER(KTime(), aSection, inputTime))
|
sl@0
|
1172 |
{
|
sl@0
|
1173 |
// Assigns a date and time contained in a descriptor.
|
sl@0
|
1174 |
TInt err = time.Set(inputTime);
|
sl@0
|
1175 |
if (err != KErrNone)
|
sl@0
|
1176 |
{
|
sl@0
|
1177 |
ERR_PRINTF2(_L("Time set failed, error %d"), err);
|
sl@0
|
1178 |
SetBlockResult(EFail);
|
sl@0
|
1179 |
}
|
sl@0
|
1180 |
}
|
sl@0
|
1181 |
|
sl@0
|
1182 |
// Reads the name of file or directory from ini file.
|
sl@0
|
1183 |
TPtrC name;
|
sl@0
|
1184 |
if (!GET_MANDATORY_STRING_PARAMETER(KName(), aSection, name))
|
sl@0
|
1185 |
{
|
sl@0
|
1186 |
dataOk = EFalse;
|
sl@0
|
1187 |
}
|
sl@0
|
1188 |
|
sl@0
|
1189 |
if ( dataOk )
|
sl@0
|
1190 |
{
|
sl@0
|
1191 |
// Sets both the attributes and the last modified date and time for a file or directory.
|
sl@0
|
1192 |
TInt err = iFs->SetEntry(name, time, setAttMask, clearAttMask);
|
sl@0
|
1193 |
if (err != KErrNone)
|
sl@0
|
1194 |
{
|
sl@0
|
1195 |
ERR_PRINTF2(_L("SetEntry error %d"), err);
|
sl@0
|
1196 |
SetError(err);
|
sl@0
|
1197 |
}
|
sl@0
|
1198 |
else
|
sl@0
|
1199 |
{
|
sl@0
|
1200 |
INFO_PRINTF1(_L("SetEntry() is successful."));
|
sl@0
|
1201 |
}
|
sl@0
|
1202 |
}
|
sl@0
|
1203 |
}
|
sl@0
|
1204 |
|
sl@0
|
1205 |
void CT_FsData::DoCmdReadFileSectionL(const TDesC& aSection)
|
sl@0
|
1206 |
{
|
sl@0
|
1207 |
TBuf<KMaxTestExecuteCommandLength> tempStore;
|
sl@0
|
1208 |
TBool dataOk = ETrue;
|
sl@0
|
1209 |
|
sl@0
|
1210 |
|
sl@0
|
1211 |
// Reads the offset, in bytes, from the start of the file where reading is to start.
|
sl@0
|
1212 |
TInt offset = 0;
|
sl@0
|
1213 |
if (!GET_MANDATORY_INT_PARAMETER(KOffset(), aSection, offset))
|
sl@0
|
1214 |
{
|
sl@0
|
1215 |
dataOk = EFalse;
|
sl@0
|
1216 |
}
|
sl@0
|
1217 |
|
sl@0
|
1218 |
// Reads the number of bytes to be read from the file.
|
sl@0
|
1219 |
TInt lengthRead = 0;
|
sl@0
|
1220 |
if (!GET_MANDATORY_INT_PARAMETER(KLengthRead(), aSection, lengthRead))
|
sl@0
|
1221 |
{
|
sl@0
|
1222 |
dataOk = EFalse;
|
sl@0
|
1223 |
}
|
sl@0
|
1224 |
|
sl@0
|
1225 |
// Reads the number of bytes to be alocated.
|
sl@0
|
1226 |
TInt lengthBuffer = 0;
|
sl@0
|
1227 |
if (!GET_MANDATORY_INT_PARAMETER(KLengthBuffer(), aSection, lengthBuffer))
|
sl@0
|
1228 |
{
|
sl@0
|
1229 |
dataOk = EFalse;
|
sl@0
|
1230 |
}
|
sl@0
|
1231 |
|
sl@0
|
1232 |
// Reads the name of file from ini file.
|
sl@0
|
1233 |
TPtrC name;
|
sl@0
|
1234 |
if (!GET_MANDATORY_STRING_PARAMETER(KName(), aSection, name))
|
sl@0
|
1235 |
{
|
sl@0
|
1236 |
dataOk = EFalse;
|
sl@0
|
1237 |
}
|
sl@0
|
1238 |
|
sl@0
|
1239 |
if ( dataOk )
|
sl@0
|
1240 |
{
|
sl@0
|
1241 |
// Creates 8-bit heap descriptor.
|
sl@0
|
1242 |
HBufC8* buffer = NULL;
|
sl@0
|
1243 |
TRAPD (err, buffer = HBufC8::NewL(lengthBuffer));
|
sl@0
|
1244 |
if (err == KErrNone)
|
sl@0
|
1245 |
{
|
sl@0
|
1246 |
// Pushes descriptor onto the cleanup stack.
|
sl@0
|
1247 |
CleanupStack::PushL(buffer);
|
sl@0
|
1248 |
|
sl@0
|
1249 |
// Create memory for 16-bit bufer.
|
sl@0
|
1250 |
HBufC* buffer16 = NULL;
|
sl@0
|
1251 |
TRAP (err, buffer16 = HBufC::NewL(lengthBuffer));
|
sl@0
|
1252 |
if (err != KErrNone)
|
sl@0
|
1253 |
{
|
sl@0
|
1254 |
ERR_PRINTF2(_L("The 16-bit heap descriptor cannot be created, err %d"), err);
|
sl@0
|
1255 |
SetBlockResult(EFail);
|
sl@0
|
1256 |
CleanupStack::PopAndDestroy(buffer);
|
sl@0
|
1257 |
}
|
sl@0
|
1258 |
else
|
sl@0
|
1259 |
{
|
sl@0
|
1260 |
// Pushes descriptor onto the cleanup stack.
|
sl@0
|
1261 |
CleanupStack::PushL(buffer16);
|
sl@0
|
1262 |
|
sl@0
|
1263 |
// Reads data from a file without opening it.
|
sl@0
|
1264 |
TPtr8 bufferPtr = buffer->Des();
|
sl@0
|
1265 |
err = iFs->ReadFileSection(name, offset, bufferPtr, lengthRead);
|
sl@0
|
1266 |
if (err != KErrNone)
|
sl@0
|
1267 |
{
|
sl@0
|
1268 |
ERR_PRINTF2(_L("ReadFileSection error %d"), err);
|
sl@0
|
1269 |
SetError(err);
|
sl@0
|
1270 |
}
|
sl@0
|
1271 |
else
|
sl@0
|
1272 |
{
|
sl@0
|
1273 |
// Writes data from a file.
|
sl@0
|
1274 |
tempStore.Format(_L("The data from a file %S, offset =%d, length_buffer =%d, length_read =%d"), &name, offset, lengthBuffer, lengthRead);
|
sl@0
|
1275 |
INFO_PRINTF1(tempStore);
|
sl@0
|
1276 |
// Converts 8-bit to 16-bit.
|
sl@0
|
1277 |
buffer16->Des().Copy(bufferPtr);
|
sl@0
|
1278 |
TPtr16 bufferPtr16 = buffer16->Des();
|
sl@0
|
1279 |
INFO_PRINTF2(_L("%S"), &bufferPtr16);
|
sl@0
|
1280 |
}
|
sl@0
|
1281 |
|
sl@0
|
1282 |
// Clean memory buffer and buffer16
|
sl@0
|
1283 |
CleanupStack::PopAndDestroy(2, buffer); // buffer, buffer16.
|
sl@0
|
1284 |
}
|
sl@0
|
1285 |
}
|
sl@0
|
1286 |
else
|
sl@0
|
1287 |
{
|
sl@0
|
1288 |
ERR_PRINTF2(_L("The 8-bit heap descriptor cannot be created, err %d"), err);
|
sl@0
|
1289 |
SetBlockResult(EFail);
|
sl@0
|
1290 |
}
|
sl@0
|
1291 |
}
|
sl@0
|
1292 |
}
|
sl@0
|
1293 |
|
sl@0
|
1294 |
void CT_FsData::DoCmdIsFileOpen(const TDesC& aSection)
|
sl@0
|
1295 |
{
|
sl@0
|
1296 |
// Reads the name of file from ini file.
|
sl@0
|
1297 |
TPtrC file;
|
sl@0
|
1298 |
if (GET_MANDATORY_STRING_PARAMETER(KFile(), aSection, file))
|
sl@0
|
1299 |
{
|
sl@0
|
1300 |
// Tests whether a file is open.
|
sl@0
|
1301 |
TBool isOpen;
|
sl@0
|
1302 |
TInt err = iFs->IsFileOpen(file, isOpen);
|
sl@0
|
1303 |
if (err != KErrNone)
|
sl@0
|
1304 |
{
|
sl@0
|
1305 |
ERR_PRINTF2(_L("IsFileOpen error %d"), err);
|
sl@0
|
1306 |
SetError(err);
|
sl@0
|
1307 |
}
|
sl@0
|
1308 |
else
|
sl@0
|
1309 |
{
|
sl@0
|
1310 |
if (isOpen)
|
sl@0
|
1311 |
{
|
sl@0
|
1312 |
INFO_PRINTF2(_L("The File %S is OPEN"), &file);
|
sl@0
|
1313 |
}
|
sl@0
|
1314 |
else
|
sl@0
|
1315 |
{
|
sl@0
|
1316 |
INFO_PRINTF2(_L("The FILE %S is CLOSED"), &file);
|
sl@0
|
1317 |
}
|
sl@0
|
1318 |
|
sl@0
|
1319 |
// Compare parameter from ini
|
sl@0
|
1320 |
TBool iniIsOpen;
|
sl@0
|
1321 |
if (GET_OPTIONAL_BOOL_PARAMETER(KIsOpen(), aSection, iniIsOpen))
|
sl@0
|
1322 |
{
|
sl@0
|
1323 |
if (isOpen != iniIsOpen)
|
sl@0
|
1324 |
{
|
sl@0
|
1325 |
ERR_PRINTF2(_L("Error compare parameter %S"), &KIsOpen);
|
sl@0
|
1326 |
SetBlockResult(EFail);
|
sl@0
|
1327 |
}
|
sl@0
|
1328 |
}
|
sl@0
|
1329 |
}
|
sl@0
|
1330 |
}
|
sl@0
|
1331 |
}
|
sl@0
|
1332 |
|
sl@0
|
1333 |
void CT_FsData::DoCmdGetShortName(const TDesC& aSection)
|
sl@0
|
1334 |
{
|
sl@0
|
1335 |
// Reads the long name of file from ini file.
|
sl@0
|
1336 |
TPtrC longName;
|
sl@0
|
1337 |
if (GET_MANDATORY_STRING_PARAMETER(KLongName(), aSection, longName))
|
sl@0
|
1338 |
{
|
sl@0
|
1339 |
// Gets the short filename associated with a VFAT long filename.
|
sl@0
|
1340 |
TBuf<KShortNameSize> shortName;
|
sl@0
|
1341 |
TInt err = iFs->GetShortName(longName, shortName);
|
sl@0
|
1342 |
if (err != KErrNone)
|
sl@0
|
1343 |
{
|
sl@0
|
1344 |
ERR_PRINTF2(_L("GetShortName error %d"), err);
|
sl@0
|
1345 |
SetError(err);
|
sl@0
|
1346 |
}
|
sl@0
|
1347 |
else
|
sl@0
|
1348 |
{
|
sl@0
|
1349 |
INFO_PRINTF2(_L("Short name: %S"), &shortName);
|
sl@0
|
1350 |
|
sl@0
|
1351 |
// Compares name from ini file and name from function.
|
sl@0
|
1352 |
TPtrC compareName;
|
sl@0
|
1353 |
if (GET_OPTIONAL_STRING_PARAMETER(KShortName(), aSection, compareName))
|
sl@0
|
1354 |
{
|
sl@0
|
1355 |
if (shortName.CompareC(compareName, 0, NULL) != 0)
|
sl@0
|
1356 |
{
|
sl@0
|
1357 |
ERR_PRINTF3(_L("%S != %S"), &shortName, &compareName);
|
sl@0
|
1358 |
SetBlockResult(EFail);
|
sl@0
|
1359 |
}
|
sl@0
|
1360 |
else
|
sl@0
|
1361 |
{
|
sl@0
|
1362 |
INFO_PRINTF3(_L("%S == %S"), &shortName, &compareName);
|
sl@0
|
1363 |
}
|
sl@0
|
1364 |
}
|
sl@0
|
1365 |
}
|
sl@0
|
1366 |
}
|
sl@0
|
1367 |
}
|
sl@0
|
1368 |
|
sl@0
|
1369 |
void CT_FsData::DoCmdGetLongName(const TDesC& aSection)
|
sl@0
|
1370 |
{
|
sl@0
|
1371 |
// Reads the short name of file from ini file.
|
sl@0
|
1372 |
TPtrC shortName;
|
sl@0
|
1373 |
if (GET_MANDATORY_STRING_PARAMETER(KShortName(), aSection, shortName))
|
sl@0
|
1374 |
{
|
sl@0
|
1375 |
// Gets the long filename associated with a short (8.3) filename.
|
sl@0
|
1376 |
TBuf<KLongNameSize> longName;
|
sl@0
|
1377 |
TInt err = iFs->GetLongName(shortName, longName);
|
sl@0
|
1378 |
if (err != KErrNone)
|
sl@0
|
1379 |
{
|
sl@0
|
1380 |
ERR_PRINTF2(_L("GetLongName error %d"), err);
|
sl@0
|
1381 |
SetError(err);
|
sl@0
|
1382 |
}
|
sl@0
|
1383 |
else
|
sl@0
|
1384 |
{
|
sl@0
|
1385 |
INFO_PRINTF2(_L("Long name: %S"), &longName);
|
sl@0
|
1386 |
|
sl@0
|
1387 |
// Compares name from ini file and name from function.
|
sl@0
|
1388 |
TPtrC compareName;
|
sl@0
|
1389 |
if (GET_OPTIONAL_STRING_PARAMETER(KLongName(), aSection, compareName))
|
sl@0
|
1390 |
{
|
sl@0
|
1391 |
if (longName.CompareC(compareName, 0, NULL) != 0)
|
sl@0
|
1392 |
{
|
sl@0
|
1393 |
ERR_PRINTF3(_L("%S != %S"), &longName, &compareName);
|
sl@0
|
1394 |
SetBlockResult(EFail);
|
sl@0
|
1395 |
}
|
sl@0
|
1396 |
else
|
sl@0
|
1397 |
{
|
sl@0
|
1398 |
INFO_PRINTF3(_L("%S == %S"), &longName, &compareName);
|
sl@0
|
1399 |
}
|
sl@0
|
1400 |
}
|
sl@0
|
1401 |
}
|
sl@0
|
1402 |
}
|
sl@0
|
1403 |
}
|
sl@0
|
1404 |
|
sl@0
|
1405 |
void CT_FsData::DoCmdIsFileInRom(const TDesC& aSection)
|
sl@0
|
1406 |
{
|
sl@0
|
1407 |
// Reads the name of file from ini file.
|
sl@0
|
1408 |
TPtrC file;
|
sl@0
|
1409 |
if (GET_MANDATORY_STRING_PARAMETER(KFile(), aSection, file))
|
sl@0
|
1410 |
{
|
sl@0
|
1411 |
// Gets a pointer to the specified file, if it is in ROM.
|
sl@0
|
1412 |
iIsFileInRom=iFs->IsFileInRom(file);
|
sl@0
|
1413 |
INFO_PRINTF2(_L("Fs->IsFileInRom = 0x%X"), iIsFileInRom);
|
sl@0
|
1414 |
|
sl@0
|
1415 |
TBool isInROM = (iIsFileInRom!=NULL);
|
sl@0
|
1416 |
if ( isInROM )
|
sl@0
|
1417 |
{
|
sl@0
|
1418 |
INFO_PRINTF2(_L("File %S in ROM"), &file);
|
sl@0
|
1419 |
}
|
sl@0
|
1420 |
else
|
sl@0
|
1421 |
{
|
sl@0
|
1422 |
INFO_PRINTF2(_L("File %S not in ROM"), &file);
|
sl@0
|
1423 |
}
|
sl@0
|
1424 |
|
sl@0
|
1425 |
// Compare parameter from ini
|
sl@0
|
1426 |
TBool iniIsInROM = FALSE;
|
sl@0
|
1427 |
if (GET_OPTIONAL_BOOL_PARAMETER(KIsInRom(), aSection, iniIsInROM))
|
sl@0
|
1428 |
{
|
sl@0
|
1429 |
if (isInROM != iniIsInROM)
|
sl@0
|
1430 |
{
|
sl@0
|
1431 |
ERR_PRINTF1(_L("Expected result does not match actual"));
|
sl@0
|
1432 |
SetBlockResult(EFail);
|
sl@0
|
1433 |
}
|
sl@0
|
1434 |
}
|
sl@0
|
1435 |
}
|
sl@0
|
1436 |
}
|
sl@0
|
1437 |
|
sl@0
|
1438 |
void CT_FsData::DoCmdIsValidName(const TDesC& aSection)
|
sl@0
|
1439 |
{
|
sl@0
|
1440 |
// Reads the name of file from ini file.
|
sl@0
|
1441 |
TPtrC name;
|
sl@0
|
1442 |
if (GET_MANDATORY_STRING_PARAMETER(KName(), aSection, name))
|
sl@0
|
1443 |
{
|
sl@0
|
1444 |
TBool isValid = FALSE;
|
sl@0
|
1445 |
TBool isBadChar;
|
sl@0
|
1446 |
if (GET_OPTIONAL_BOOL_PARAMETER(KIsBadChar(), aSection, isBadChar))
|
sl@0
|
1447 |
{
|
sl@0
|
1448 |
// Tests whether a filename and path are syntactically correct.
|
sl@0
|
1449 |
// badChar = on return, contains any illegal character within name,
|
sl@0
|
1450 |
// if the path is valid, badChar is blank.
|
sl@0
|
1451 |
|
sl@0
|
1452 |
TText badChar;
|
sl@0
|
1453 |
isValid = iFs->IsValidName(name, badChar);
|
sl@0
|
1454 |
INFO_PRINTF2(_L("BadChar: %c"), badChar);
|
sl@0
|
1455 |
|
sl@0
|
1456 |
TPtrC iniBadChar;
|
sl@0
|
1457 |
if (GET_OPTIONAL_STRING_PARAMETER(KBadChar(), aSection, iniBadChar))
|
sl@0
|
1458 |
{
|
sl@0
|
1459 |
TText expectedBadChar=iniBadChar[0];
|
sl@0
|
1460 |
if (badChar != expectedBadChar)
|
sl@0
|
1461 |
{
|
sl@0
|
1462 |
ERR_PRINTF3(_L("Error compare badchar %c != %c"), badChar, expectedBadChar);
|
sl@0
|
1463 |
SetBlockResult(EFail);
|
sl@0
|
1464 |
}
|
sl@0
|
1465 |
else
|
sl@0
|
1466 |
{
|
sl@0
|
1467 |
INFO_PRINTF3(_L("Badchar's has equal value %c == %c"), badChar, expectedBadChar);
|
sl@0
|
1468 |
}
|
sl@0
|
1469 |
}
|
sl@0
|
1470 |
}
|
sl@0
|
1471 |
else
|
sl@0
|
1472 |
{
|
sl@0
|
1473 |
// Tests whether a filename and path are syntactically correct.
|
sl@0
|
1474 |
isValid = iFs->IsValidName(name);
|
sl@0
|
1475 |
}
|
sl@0
|
1476 |
|
sl@0
|
1477 |
if (isValid)
|
sl@0
|
1478 |
{
|
sl@0
|
1479 |
INFO_PRINTF2(_L("Name %S is valid"), &name);
|
sl@0
|
1480 |
}
|
sl@0
|
1481 |
else
|
sl@0
|
1482 |
{
|
sl@0
|
1483 |
INFO_PRINTF2(_L("Name %S is not valid"), &name);
|
sl@0
|
1484 |
}
|
sl@0
|
1485 |
|
sl@0
|
1486 |
// Compare parameter from ini
|
sl@0
|
1487 |
TBool iniIsValid;
|
sl@0
|
1488 |
if (GET_OPTIONAL_BOOL_PARAMETER(KIsValid(), aSection, iniIsValid))
|
sl@0
|
1489 |
{
|
sl@0
|
1490 |
if (isValid != iniIsValid)
|
sl@0
|
1491 |
{
|
sl@0
|
1492 |
ERR_PRINTF1(_L("Error compare with ini parameter"));
|
sl@0
|
1493 |
SetBlockResult(EFail);
|
sl@0
|
1494 |
}
|
sl@0
|
1495 |
}
|
sl@0
|
1496 |
}
|
sl@0
|
1497 |
}
|
sl@0
|
1498 |
|
sl@0
|
1499 |
void CT_FsData::DoCmdSetSessionToPrivate(const TDesC& aSection)
|
sl@0
|
1500 |
{
|
sl@0
|
1501 |
// Reads the name of drive from ini file.
|
sl@0
|
1502 |
TDriveNumber driveNumber;
|
sl@0
|
1503 |
if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
1504 |
{
|
sl@0
|
1505 |
ERR_PRINTF2(_L("Error read parameter %S"), &KDrive());
|
sl@0
|
1506 |
SetBlockResult(EFail);
|
sl@0
|
1507 |
}
|
sl@0
|
1508 |
else
|
sl@0
|
1509 |
{
|
sl@0
|
1510 |
// Sets the session path to point to the private path on the specified drive.
|
sl@0
|
1511 |
TInt err = iFs->SetSessionToPrivate(driveNumber);
|
sl@0
|
1512 |
if (err != KErrNone)
|
sl@0
|
1513 |
{
|
sl@0
|
1514 |
ERR_PRINTF2(_L("SetSessionToPrivate error %d"), err);
|
sl@0
|
1515 |
SetError(err);
|
sl@0
|
1516 |
}
|
sl@0
|
1517 |
else
|
sl@0
|
1518 |
{
|
sl@0
|
1519 |
INFO_PRINTF1(_L("Function DoCmdSetSessionToPrivate() OK"));
|
sl@0
|
1520 |
}
|
sl@0
|
1521 |
}
|
sl@0
|
1522 |
}
|
sl@0
|
1523 |
|
sl@0
|
1524 |
void CT_FsData::DoCmdPrivatePath(const TDesC& aSection)
|
sl@0
|
1525 |
{
|
sl@0
|
1526 |
// Creates the text defining the private path for a process.
|
sl@0
|
1527 |
TBuf<KMaxTestExecuteCommandLength> privatePath;
|
sl@0
|
1528 |
TInt err = iFs->PrivatePath(privatePath);
|
sl@0
|
1529 |
if (err != KErrNone)
|
sl@0
|
1530 |
{
|
sl@0
|
1531 |
ERR_PRINTF2(_L("PrivatePath error %d"), err);
|
sl@0
|
1532 |
SetError(err);
|
sl@0
|
1533 |
}
|
sl@0
|
1534 |
else
|
sl@0
|
1535 |
{
|
sl@0
|
1536 |
INFO_PRINTF2(_L("PrivatePath: %S"), &privatePath);
|
sl@0
|
1537 |
|
sl@0
|
1538 |
// Compares path from ini file and path from function.
|
sl@0
|
1539 |
TPtrC comparePath;
|
sl@0
|
1540 |
if (GET_OPTIONAL_STRING_PARAMETER(KComparePath(), aSection, comparePath))
|
sl@0
|
1541 |
{
|
sl@0
|
1542 |
if (comparePath.CompareC(privatePath, 0, NULL) != 0)
|
sl@0
|
1543 |
{
|
sl@0
|
1544 |
ERR_PRINTF3(_L("%S != %S"), &privatePath, &comparePath);
|
sl@0
|
1545 |
SetBlockResult(EFail);
|
sl@0
|
1546 |
}
|
sl@0
|
1547 |
else
|
sl@0
|
1548 |
{
|
sl@0
|
1549 |
INFO_PRINTF3(_L("%S == %S"), &privatePath, &comparePath);
|
sl@0
|
1550 |
}
|
sl@0
|
1551 |
}
|
sl@0
|
1552 |
}
|
sl@0
|
1553 |
}
|
sl@0
|
1554 |
|
sl@0
|
1555 |
void CT_FsData::DoCmdCreatePrivatePath(const TDesC& aSection)
|
sl@0
|
1556 |
{
|
sl@0
|
1557 |
// Reads the name of drive from ini file.
|
sl@0
|
1558 |
TDriveNumber driveNumber;
|
sl@0
|
1559 |
if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
1560 |
{
|
sl@0
|
1561 |
ERR_PRINTF2(_L("Error read parameter %S"), &KDrive());
|
sl@0
|
1562 |
SetBlockResult(EFail);
|
sl@0
|
1563 |
}
|
sl@0
|
1564 |
else
|
sl@0
|
1565 |
{
|
sl@0
|
1566 |
// Creates the private path for a process on the specified drive.
|
sl@0
|
1567 |
TInt err = iFs->CreatePrivatePath(driveNumber);
|
sl@0
|
1568 |
if (err != KErrNone)
|
sl@0
|
1569 |
{
|
sl@0
|
1570 |
ERR_PRINTF2(_L("PrivatePath error %d"), err);
|
sl@0
|
1571 |
SetError(err);
|
sl@0
|
1572 |
}
|
sl@0
|
1573 |
else
|
sl@0
|
1574 |
{
|
sl@0
|
1575 |
INFO_PRINTF1(_L("Function DoCmdCreatePrivatePath() OK"));
|
sl@0
|
1576 |
}
|
sl@0
|
1577 |
}
|
sl@0
|
1578 |
}
|
sl@0
|
1579 |
|
sl@0
|
1580 |
TBool CT_FsData::ConvertToSortKey(const TDesC& aSortKeyStr, TUint& aSortKey)
|
sl@0
|
1581 |
{
|
sl@0
|
1582 |
TBool ret = ETrue;
|
sl@0
|
1583 |
|
sl@0
|
1584 |
if (aSortKeyStr == KESortNone)
|
sl@0
|
1585 |
{
|
sl@0
|
1586 |
aSortKey = ESortNone;
|
sl@0
|
1587 |
}
|
sl@0
|
1588 |
else if (aSortKeyStr == KESortByName)
|
sl@0
|
1589 |
{
|
sl@0
|
1590 |
aSortKey = ESortByName;
|
sl@0
|
1591 |
}
|
sl@0
|
1592 |
else if (aSortKeyStr == KESortByExt)
|
sl@0
|
1593 |
{
|
sl@0
|
1594 |
aSortKey = ESortByExt;
|
sl@0
|
1595 |
}
|
sl@0
|
1596 |
else if (aSortKeyStr == KESortBySize)
|
sl@0
|
1597 |
{
|
sl@0
|
1598 |
aSortKey = ESortBySize;
|
sl@0
|
1599 |
}
|
sl@0
|
1600 |
else if (aSortKeyStr == KESortByDate)
|
sl@0
|
1601 |
{
|
sl@0
|
1602 |
aSortKey = ESortByDate;
|
sl@0
|
1603 |
}
|
sl@0
|
1604 |
else if (aSortKeyStr == KESortByUid)
|
sl@0
|
1605 |
{
|
sl@0
|
1606 |
aSortKey = ESortByUid;
|
sl@0
|
1607 |
}
|
sl@0
|
1608 |
else if (aSortKeyStr == KEDirsAnyOrder)
|
sl@0
|
1609 |
{
|
sl@0
|
1610 |
aSortKey = EDirsAnyOrder;
|
sl@0
|
1611 |
}
|
sl@0
|
1612 |
else if (aSortKeyStr == KEDirsFirst)
|
sl@0
|
1613 |
{
|
sl@0
|
1614 |
aSortKey = EDirsFirst;
|
sl@0
|
1615 |
}
|
sl@0
|
1616 |
else if (aSortKeyStr == KEDirsLast)
|
sl@0
|
1617 |
{
|
sl@0
|
1618 |
aSortKey = EDirsLast;
|
sl@0
|
1619 |
}
|
sl@0
|
1620 |
else if (aSortKeyStr == KEAscending)
|
sl@0
|
1621 |
{
|
sl@0
|
1622 |
aSortKey = EAscending;
|
sl@0
|
1623 |
}
|
sl@0
|
1624 |
else if (aSortKeyStr == KEDescending)
|
sl@0
|
1625 |
{
|
sl@0
|
1626 |
aSortKey = EDescending;
|
sl@0
|
1627 |
}
|
sl@0
|
1628 |
else if (aSortKeyStr == KEDirDescending)
|
sl@0
|
1629 |
{
|
sl@0
|
1630 |
aSortKey = EDirDescending;
|
sl@0
|
1631 |
}
|
sl@0
|
1632 |
else if (aSortKeyStr.Match((_L("*|*"))) != KErrNotFound)
|
sl@0
|
1633 |
{
|
sl@0
|
1634 |
TUint tmpSortKey;
|
sl@0
|
1635 |
|
sl@0
|
1636 |
TInt location = aSortKeyStr.Match(_L("*|*"));
|
sl@0
|
1637 |
//Converting Left part of the data
|
sl@0
|
1638 |
TPtrC left = aSortKeyStr.Left(location);
|
sl@0
|
1639 |
if (ConvertToSortKey(left, tmpSortKey))
|
sl@0
|
1640 |
{
|
sl@0
|
1641 |
aSortKey = tmpSortKey;
|
sl@0
|
1642 |
}
|
sl@0
|
1643 |
else
|
sl@0
|
1644 |
{
|
sl@0
|
1645 |
ret = EFalse;
|
sl@0
|
1646 |
}
|
sl@0
|
1647 |
|
sl@0
|
1648 |
//Converting right data can be with another "|"
|
sl@0
|
1649 |
TPtrC right = aSortKeyStr.Mid(location + 1);
|
sl@0
|
1650 |
|
sl@0
|
1651 |
if (ConvertToSortKey(right, tmpSortKey))
|
sl@0
|
1652 |
{
|
sl@0
|
1653 |
aSortKey = aSortKey | tmpSortKey;
|
sl@0
|
1654 |
}
|
sl@0
|
1655 |
else
|
sl@0
|
1656 |
{
|
sl@0
|
1657 |
ret = EFalse;
|
sl@0
|
1658 |
}
|
sl@0
|
1659 |
}
|
sl@0
|
1660 |
else
|
sl@0
|
1661 |
{
|
sl@0
|
1662 |
ret = EFalse;
|
sl@0
|
1663 |
}
|
sl@0
|
1664 |
|
sl@0
|
1665 |
return ret;
|
sl@0
|
1666 |
}
|
sl@0
|
1667 |
|
sl@0
|
1668 |
const TDesC& CT_FsData::ConvertToStrAttMask(TUint aAttMask)
|
sl@0
|
1669 |
{
|
sl@0
|
1670 |
switch(aAttMask)
|
sl@0
|
1671 |
{
|
sl@0
|
1672 |
case KEntryAttReadOnly:
|
sl@0
|
1673 |
return KEntryAttReadOnlyStr;
|
sl@0
|
1674 |
case KEntryAttHidden:
|
sl@0
|
1675 |
return KEntryAttHiddenStr;
|
sl@0
|
1676 |
case KEntryAttSystem:
|
sl@0
|
1677 |
return KEntryAttSystemStr;
|
sl@0
|
1678 |
case KEntryAttVolume:
|
sl@0
|
1679 |
return KEntryAttVolumeStr;
|
sl@0
|
1680 |
case KEntryAttDir:
|
sl@0
|
1681 |
return KEntryAttDirStr;
|
sl@0
|
1682 |
case KEntryAttArchive:
|
sl@0
|
1683 |
return KEntryAttArchiveStr;
|
sl@0
|
1684 |
case KEntryAttXIP:
|
sl@0
|
1685 |
return KEntryAttXIPStr;
|
sl@0
|
1686 |
default:
|
sl@0
|
1687 |
break;
|
sl@0
|
1688 |
};
|
sl@0
|
1689 |
return KEntryAttUnknown;
|
sl@0
|
1690 |
}
|