|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <f32file.h> |
|
19 |
|
20 #include "CTcFileHandler.h" |
|
21 |
|
22 #include "TCmdDeleteFile.h" |
|
23 #include "SIPConstants.h" |
|
24 #include "CTcSIPContext.h" |
|
25 |
|
26 /** |
|
27 * INPUT: |
|
28 * Headers: - |
|
29 * Parameters: File |
|
30 * IDs: - |
|
31 * |
|
32 * OUTPUT: |
|
33 * Parameters: - |
|
34 * IDs: - |
|
35 */ |
|
36 void TCmdDeleteFile::ExecuteL() |
|
37 { |
|
38 // -- Setup --------------------------------------------------------------- |
|
39 |
|
40 // Use FileHandler server for deleting since SIPTester cannot have access |
|
41 // to /sys and /resource directories |
|
42 TPtrC8 fileName = ExtractTextL( KParamFile ); |
|
43 iContext.FileHandler().DeleteFileL( fileName ); |
|
44 |
|
45 |
|
46 /* |
|
47 // Get file name to be deleted, convert to unicode |
|
48 TFileName fileName16; |
|
49 fileName16.Copy( ExtractTextL( KParamFile ) ); |
|
50 |
|
51 // -- Execution ----------------------------------------------------------- |
|
52 |
|
53 // Connect to file server |
|
54 RFs fs; |
|
55 User::LeaveIfError( fs.Connect() ); |
|
56 CleanupClosePushL( fs ); |
|
57 |
|
58 // Clear read-only and system flags in order to be able to delete the file |
|
59 // Ignore errors. |
|
60 fs.SetAtt( fileName16, 0, KEntryAttReadOnly | KEntryAttSystem ); |
|
61 |
|
62 // Try deleting the file, report errors (typically KErrNotFound) |
|
63 User::LeaveIfError( fs.Delete( fileName16 ) ); |
|
64 |
|
65 // Close file server session |
|
66 CleanupStack::PopAndDestroy(); // fs |
|
67 */ |
|
68 |
|
69 // -- Response creation --------------------------------------------------- |
|
70 } |
|
71 |
|
72 TBool TCmdDeleteFile::Match( const TTcIdentifier& aId ) |
|
73 { |
|
74 return TTcSIPCommandBase::Match( aId, _L8("DeleteFile") ); |
|
75 } |
|
76 |
|
77 TTcCommandBase* TCmdDeleteFile::CreateL( MTcTestContext& aContext ) |
|
78 { |
|
79 return new( ELeave ) TCmdDeleteFile( aContext ); |
|
80 } |
|
81 |