• May 18, 2024, 01:53:40 pm

Author Topic: How to set a file read only or remove read only flag  (Read 1228 times)

0 Members and 1 Guest are viewing this topic.

Offline huellif

  • Developer
  • Christmas Santa
  • ****
  • Posts: 402
  • Reputation: 212
How to set a file read only or remove read only flag
« on: September 01, 2013, 12:22:08 am »
add to your .pro:
Code: [Select]
LIBS += -lefsrv -lbafl

inlude:
Code: [Select]
#include <e32base.h>
#include <bautils.h>
#include <f32file.h>

the method to set a file read only:
Code: [Select]
RFs fsSession;
CleanupClosePushL(fsSession);
User::LeaveIfError( fsSession.Connect() );
fsSession.SetAtt((_L("path")),KEntryAttReadOnly,KEntryAttHidden);
CleanupStack::PopAndDestroy(&fsSession);


for your path set e.g.: C:\\system\\data\\whatsapp_notifier.rsc

to set no attributes:
Code: [Select]
RFs fsSession;
CleanupClosePushL(fsSession);
User::LeaveIfError( fsSession.Connect() );
fsSession.SetAtt((_L("path")),KEntryAttNormal,KEntryAttReadOnly | KEntryAttSystem);
CleanupStack::PopAndDestroy(&fsSession);


should also work with folders 
« Last Edit: October 30, 2013, 01:32:53 am by huellif »