What is the preferred way to remove the readonly attribute of a file in Compact Framework as we don't have a File::SetAttributes?
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With