From b1859d41e861630a95357bf21bb46af6c4fb5686 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 7 Oct 2015 17:42:29 -0400 Subject: update collection menus --- .../Configuration/BaseConfigurationManager.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs') diff --git a/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs b/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs index 1b9146644..0bcc5c711 100644 --- a/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs +++ b/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; +using CommonIO; namespace MediaBrowser.Common.Implementations.Configuration { @@ -54,6 +55,7 @@ namespace MediaBrowser.Common.Implementations.Configuration /// /// The application paths. public IApplicationPaths CommonApplicationPaths { get; private set; } + public readonly IFileSystem FileSystem; /// /// The _configuration loaded @@ -96,10 +98,11 @@ namespace MediaBrowser.Common.Implementations.Configuration /// The application paths. /// The log manager. /// The XML serializer. - protected BaseConfigurationManager(IApplicationPaths applicationPaths, ILogManager logManager, IXmlSerializer xmlSerializer) + protected BaseConfigurationManager(IApplicationPaths applicationPaths, ILogManager logManager, IXmlSerializer xmlSerializer, IFileSystem fileSystem) { CommonApplicationPaths = applicationPaths; XmlSerializer = xmlSerializer; + FileSystem = fileSystem; Logger = logManager.GetLogger(GetType().Name); UpdateCachePath(); @@ -199,9 +202,19 @@ namespace MediaBrowser.Common.Implementations.Configuration { throw new DirectoryNotFoundException(string.Format("{0} does not exist.", newPath)); } + + EnsureWriteAccess(newPath); } } + protected void EnsureWriteAccess(string path) + { + var file = Path.Combine(path, Guid.NewGuid().ToString()); + + FileSystem.WriteAllText(file, string.Empty); + FileSystem.DeleteFile(file); + } + private readonly ConcurrentDictionary _configurations = new ConcurrentDictionary(); private string GetConfigurationFile(string key) -- cgit v1.2.3