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

Fixed: Set permissions on new series folders (mono)

This commit is contained in:
Mark McDowall 2014-08-10 21:20:06 -07:00
parent 78e5209cfd
commit 9ffdf18935

View File

@ -1,4 +1,5 @@
using System.Diagnostics; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using NLog; using NLog;
@ -74,6 +75,7 @@ public void Scan(Series series)
{ {
_logger.Debug("Creating missing series folder: {0}", series.Path); _logger.Debug("Creating missing series folder: {0}", series.Path);
_diskProvider.CreateFolder(series.Path); _diskProvider.CreateFolder(series.Path);
SetPermissions(series.Path);
} }
else else
{ {
@ -112,6 +114,27 @@ public string[] GetVideoFiles(string path, bool allDirectories = true)
return mediaFileList.ToArray(); return mediaFileList.ToArray();
} }
private void SetPermissions(String path)
{
if (!_configService.SetPermissionsLinux)
{
return;
}
try
{
var permissions = _configService.FolderChmod;
_diskProvider.SetPermissions(path, permissions, _configService.ChownUser, _configService.ChownGroup);
}
catch (Exception ex)
{
_logger.WarnException("Unable to apply permissions to: " + path, ex);
_logger.DebugException(ex.Message, ex);
}
}
public void Handle(SeriesUpdatedEvent message) public void Handle(SeriesUpdatedEvent message)
{ {
Scan(message.Series); Scan(message.Series);