1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-17 10:45:49 +02:00

Fixed: Only clear readonly flag when file has readonly flag

This commit is contained in:
Mark McDowall 2014-03-20 22:42:31 -07:00
parent 4752ba3341
commit b47fa831ae

View File

@ -401,8 +401,13 @@ private static void RemoveReadOnly(string path)
{
if (File.Exists(path))
{
var newAttributes = File.GetAttributes(path) & ~(FileAttributes.ReadOnly);
File.SetAttributes(path, newAttributes);
var attributes = File.GetAttributes(path);
if (attributes.HasFlag(FileAttributes.ReadOnly))
{
var newAttributes = attributes & ~(FileAttributes.ReadOnly);
File.SetAttributes(path, newAttributes);
}
}
}