|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <f32file.h> |
|
17 #include <e32debug.h> |
|
18 |
|
19 // This function is used in the test code to create dummy test files to verify |
|
20 //that these files are deleted by the task scheduler on startup |
|
21 _LIT(KTaskFile1Name, "_:\\Private\\10005399\\12345678901234567890.tmp"); |
|
22 _LIT(KTaskFile2Name, "_:\\Private\\10005399\\98765432100123456789.tmp"); |
|
23 _LIT(KTaskFile3Name, "_:\\Private\\10005399\\98765432109876543210.tmp"); |
|
24 |
|
25 static TInt CreateFileL(const TDesC& aFileName) |
|
26 { |
|
27 RFs fs; |
|
28 RFile taskFile; |
|
29 |
|
30 User::LeaveIfError(fs.Connect()); |
|
31 |
|
32 //Get the correct system drive |
|
33 TBuf<64> filePath(aFileName); |
|
34 filePath[0] = RFs::GetSystemDriveChar(); |
|
35 |
|
36 //Create the temp file |
|
37 TInt res = taskFile.Create(fs,filePath,EFileRead); |
|
38 taskFile.Close(); |
|
39 |
|
40 fs.Close(); |
|
41 |
|
42 return res; |
|
43 } |
|
44 |
|
45 static TInt CreateTaskFilesL() |
|
46 { |
|
47 |
|
48 //Create the temp file |
|
49 TInt res = CreateFileL(KTaskFile1Name); |
|
50 |
|
51 if(res ==KErrNone) |
|
52 { |
|
53 res = CreateFileL(KTaskFile2Name); |
|
54 } |
|
55 |
|
56 if(res ==KErrNone) |
|
57 { |
|
58 res = CreateFileL(KTaskFile3Name); |
|
59 } |
|
60 |
|
61 return res; |
|
62 } |
|
63 |
|
64 |
|
65 GLDEF_C TInt E32Main() |
|
66 { |
|
67 TInt err = KErrNoMemory; |
|
68 CTrapCleanup* cleanup=CTrapCleanup::New(); //can fail |
|
69 if (cleanup) |
|
70 { |
|
71 err = KErrNone; |
|
72 TRAP(err, CreateTaskFilesL()) |
|
73 delete cleanup; |
|
74 } |
|
75 return err; |
|
76 } |