From 9ffdf1893504385842c8c10272ee451453195936 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 10 Aug 2014 21:20:06 -0700 Subject: [PATCH] Fixed: Set permissions on new series folders (mono) --- .../MediaFiles/DiskScanService.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs index 4bdfe04b7..13a1cd83a 100644 --- a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs +++ b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; using System.IO; using System.Linq; using NLog; @@ -74,6 +75,7 @@ public void Scan(Series series) { _logger.Debug("Creating missing series folder: {0}", series.Path); _diskProvider.CreateFolder(series.Path); + SetPermissions(series.Path); } else { @@ -112,6 +114,27 @@ public string[] GetVideoFiles(string path, bool allDirectories = true) 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) { Scan(message.Series);