Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove readonly in Compact Framework

What is the preferred way to remove the readonly attribute of a file in Compact Framework as we don't have a File::SetAttributes?

like image 631
user128873 Avatar asked Jan 18 '10 15:01

user128873


1 Answers

This also works:

FileInfo fileInfo = new FileInfo(path);
FileAttributes attributes = fileInfo.Attributes;

if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
{
    // set the attributes to nonreadonly
    fileInfo.Attributes &= ~FileAttributes.ReadOnly;
}
like image 138
Bryan Avatar answered Nov 07 '22 18:11

Bryan