TInt CIAUpdateXmlParser::SetSessionPrivatePathL( 
    RFs& aFs,
    const TDesC& aPath ) const
    {
    IAUPDATE_TRACE_1("[IAUPDATE] CIAUpdateXmlParser::SetSessionPrivateL() begin: %S", 
                     &aPath);
                     
    // Use the parser to get the drive information from the path.
    TParsePtrC parser( aPath );

    if ( !parser.DrivePresent() )
        {
        IAUPDATE_TRACE("[IAUPDATE] ERROR: Missing drive info.");
        User::Leave( KErrArgument );
        }

    // Drive check was passed above.
    // So, drive information is safe to use.
    const TDesC& drive( parser.Drive() );
    const TChar driveChar( drive[ 0 ] );
    TInt driveNum( EDriveA );
    User::LeaveIfError( 
        RFs::CharToDrive( driveChar, driveNum ) );
    IAUPDATE_TRACE_2("[IAUPDATE] Drive: %S, %d", &drive, driveNum );

    // Set the file drive to be file session private path drive.
    User::LeaveIfError( aFs.SetSessionToPrivate( driveNum ) );

    IAUPDATE_TRACE_1("[IAUPDATE] CIAUpdateXmlParser::SetSessionPrivateL() end: %d",
                     driveNum);

    return driveNum;
    }
Exemplo n.º 2
0
TInt PosixFilesystem::SetDefaultDir (RFs& aFs)
{
    TParse parse;
    parse.Set(RProcess().FileName(), NULL, NULL);
#ifdef __SECURE_DATA__
    return aFs.SetSessionToPrivate(TDriveUnit(parse.Drive()));
#else
    return aFs.SetSessionPath(parse.DriveAndPath());
#endif
}