os/ossrv/lowlevellibsandfws/pluginfw/Framework/EcomTestUtils/t_makefilereadonly.cpp
First public contribution.
     1 // Copyright (c) 2006-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".
 
     8 // Initial Contributors:
 
     9 // Nokia Corporation - initial contribution.
 
    14 // Helper process with high capability to perform file operation for
 
    23 void DoMakeFileReadOnlyL(const TDesC& aFile)
 
    25 	// Setting read only flag for a file
 
    26 	RDebug::Print(_L("Making file read only %S\n"), &aFile);            
 
    29 	User::LeaveIfError(fs.Connect());
 
    30 	CleanupClosePushL(fs);
 
    31 	CFileMan* fileMan = CFileMan::NewL(fs);
 
    32 	TInt err = fileMan->Attribs(aFile,KEntryAttReadOnly,KEntryAttNormal,TTime(0),0);
 
    34 	CleanupStack::PopAndDestroy(); // fs.Close()
 
    35 	User::LeaveIfError(err);
 
    38 static TInt MakeFileReadOnly(const TDesC& aFile)
 
    40 	TRAPD(err, DoMakeFileReadOnlyL(aFile));
 
    44 GLDEF_C TInt E32Main()
 
    46 	CTrapCleanup* cleanup =   CTrapCleanup::New(); 
 
    49 	User::CommandLine(fileName);
 
    50 	TInt err = MakeFileReadOnly(fileName);