1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Only run InheritFolderPermissions on Windows

This commit is contained in:
Mark McDowall 2013-10-16 17:20:28 -07:00
parent acd2069d5a
commit c708b5ce1a

View File

@ -3,6 +3,7 @@
using System.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Organizer;
using NzbDrone.Core.Parser.Model;
@ -84,15 +85,19 @@ private void MoveFile(EpisodeFile episodeFile, Series series, string destination
_diskProvider.SetFolderWriteTime(seasonFolder, episodeFile.DateAdded);
}
//Wrapped in Try/Catch to prevent this from causing issues with remote NAS boxes, the move worked, which is more important.
try
//We should only run this on Windows
if (OsInfo.IsWindows)
{
_diskProvider.InheritFolderPermissions(destinationFilename);
}
catch (UnauthorizedAccessException ex)
{
_logger.Debug("Unable to apply folder permissions to: ", destinationFilename);
_logger.TraceException(ex.Message, ex);
//Wrapped in Try/Catch to prevent this from causing issues with remote NAS boxes, the move worked, which is more important.
try
{
_diskProvider.InheritFolderPermissions(destinationFilename);
}
catch (UnauthorizedAccessException ex)
{
_logger.Debug("Unable to apply folder permissions to: ", destinationFilename);
_logger.TraceException(ex.Message, ex);
}
}
}
}