sysstatemgmt/systemstatereferenceplugins/custcmd/src/cmdinitramdrive.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 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: Custom command to intialise the RAM drive.
       
    14 //
       
    15 
       
    16 #include "cmdinitramdrive.h"
       
    17 
       
    18 //RAM drive directories created on every boot
       
    19 _LIT(KRAMDriveTempPath, "\\system\\temp\\");
       
    20 _LIT(KWAPCachePath, "\\wap\\");
       
    21 _LIT(KCBSCachePath, "\\cbs\\");
       
    22 
       
    23 CCustomCmdInitRamDrive* CCustomCmdInitRamDrive::NewL()
       
    24 	{
       
    25 	return new (ELeave) CCustomCmdInitRamDrive();
       
    26 	}
       
    27 
       
    28 CCustomCmdInitRamDrive::~CCustomCmdInitRamDrive()
       
    29     {
       
    30     }
       
    31 
       
    32 CCustomCmdInitRamDrive::CCustomCmdInitRamDrive()
       
    33     {
       
    34     }
       
    35 
       
    36 TInt CCustomCmdInitRamDrive::Initialize(CSsmCustomCommandEnv* aCmdEnv)
       
    37     {
       
    38     //Using the RFs from the command environment
       
    39     iFs.SetHandle(aCmdEnv->Rfs().Handle());
       
    40     return KErrNone;
       
    41     }
       
    42 
       
    43 void CCustomCmdInitRamDrive::Execute(const TDesC8& /*aParams*/, TRequestStatus& aRequest)
       
    44     {
       
    45     aRequest = KRequestPending;
       
    46     TChar ramDriveLetter;
       
    47     // Ignore errors
       
    48     iFs.DriveToChar( EDriveD, ramDriveLetter );
       
    49 
       
    50     //Buffer containing drive id (drive letter + :)
       
    51     TBuf<2> driveName;
       
    52     driveName.Append(ramDriveLetter);
       
    53     driveName.Append(TChar(':'));
       
    54 
       
    55     TParse parse;
       
    56     // Ignore errors.
       
    57     parse.SetNoWild(KRAMDriveTempPath, &driveName, NULL);
       
    58     iFs.MkDirAll(parse.DriveAndPath());
       
    59 
       
    60     parse.SetNoWild(KWAPCachePath, &driveName, NULL);
       
    61     iFs.MkDirAll(parse.DriveAndPath());
       
    62 
       
    63     parse.SetNoWild(KCBSCachePath, &driveName, NULL);
       
    64     iFs.MkDirAll(parse.DriveAndPath());
       
    65 
       
    66     TRequestStatus* request = &aRequest;
       
    67     User::RequestComplete(request, KErrNone);
       
    68     }
       
    69 
       
    70 void CCustomCmdInitRamDrive::ExecuteCancel()
       
    71     {
       
    72     //Nothing to cancel
       
    73     }
       
    74 
       
    75 void CCustomCmdInitRamDrive::Close()
       
    76     {
       
    77     }
       
    78 
       
    79 void CCustomCmdInitRamDrive::Release()
       
    80     {
       
    81 	delete this;
       
    82     }