mirror of
https://github.com/Radarr/Radarr
synced 2025-02-26 16:13:19 +00:00
Fixed: Only clear readonly flag when file has readonly flag
This commit is contained in:
parent
4752ba3341
commit
b47fa831ae
1 changed files with 7 additions and 2 deletions
|
@ -401,8 +401,13 @@ private static void RemoveReadOnly(string path)
|
||||||
{
|
{
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
{
|
{
|
||||||
var newAttributes = File.GetAttributes(path) & ~(FileAttributes.ReadOnly);
|
var attributes = File.GetAttributes(path);
|
||||||
File.SetAttributes(path, newAttributes);
|
|
||||||
|
if (attributes.HasFlag(FileAttributes.ReadOnly))
|
||||||
|
{
|
||||||
|
var newAttributes = attributes & ~(FileAttributes.ReadOnly);
|
||||||
|
File.SetAttributes(path, newAttributes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue