From be7918e5f68f67ed32a50c2d86ee9cae79cf2b93 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 30 Oct 2013 10:40:14 -0400 Subject: fixes #567 - Deprecate native shortcut code --- MediaBrowser.Api/Library/LibraryStructureService.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'MediaBrowser.Api/Library/LibraryStructureService.cs') diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.cs index e6fa1d1c0..a5476ec8b 100644 --- a/MediaBrowser.Api/Library/LibraryStructureService.cs +++ b/MediaBrowser.Api/Library/LibraryStructureService.cs @@ -186,6 +186,8 @@ namespace MediaBrowser.Api.Library private readonly IDirectoryWatchers _directoryWatchers; + private readonly IFileSystem _fileSystem; + /// /// Initializes a new instance of the class. /// @@ -193,7 +195,7 @@ namespace MediaBrowser.Api.Library /// The user manager. /// The library manager. /// appPaths - public LibraryStructureService(IServerApplicationPaths appPaths, IUserManager userManager, ILibraryManager libraryManager, IDirectoryWatchers directoryWatchers) + public LibraryStructureService(IServerApplicationPaths appPaths, IUserManager userManager, ILibraryManager libraryManager, IDirectoryWatchers directoryWatchers, IFileSystem fileSystem) { if (appPaths == null) { @@ -204,6 +206,7 @@ namespace MediaBrowser.Api.Library _appPaths = appPaths; _libraryManager = libraryManager; _directoryWatchers = directoryWatchers; + _fileSystem = fileSystem; } /// @@ -241,13 +244,13 @@ namespace MediaBrowser.Api.Library { if (string.IsNullOrEmpty(request.UserId)) { - LibraryHelpers.AddVirtualFolder(request.Name, request.CollectionType, null, _appPaths); + LibraryHelpers.AddVirtualFolder(_fileSystem, request.Name, request.CollectionType, null, _appPaths); } else { var user = _userManager.GetUserById(new Guid(request.UserId)); - LibraryHelpers.AddVirtualFolder(request.Name, request.CollectionType, user, _appPaths); + LibraryHelpers.AddVirtualFolder(_fileSystem, request.Name, request.CollectionType, user, _appPaths); } // Need to add a delay here or directory watchers may still pick up the changes @@ -352,13 +355,13 @@ namespace MediaBrowser.Api.Library { if (string.IsNullOrEmpty(request.UserId)) { - LibraryHelpers.AddMediaPath(request.Name, request.Path, null, _appPaths); + LibraryHelpers.AddMediaPath(_fileSystem, request.Name, request.Path, null, _appPaths); } else { var user = _userManager.GetUserById(new Guid(request.UserId)); - LibraryHelpers.AddMediaPath(request.Name, request.Path, user, _appPaths); + LibraryHelpers.AddMediaPath(_fileSystem, request.Name, request.Path, user, _appPaths); } // Need to add a delay here or directory watchers may still pick up the changes @@ -389,13 +392,13 @@ namespace MediaBrowser.Api.Library { if (string.IsNullOrEmpty(request.UserId)) { - LibraryHelpers.RemoveMediaPath(request.Name, request.Path, null, _appPaths); + LibraryHelpers.RemoveMediaPath(_fileSystem, request.Name, request.Path, null, _appPaths); } else { var user = _userManager.GetUserById(new Guid(request.UserId)); - LibraryHelpers.RemoveMediaPath(request.Name, request.Path, user, _appPaths); + LibraryHelpers.RemoveMediaPath(_fileSystem, request.Name, request.Path, user, _appPaths); } // Need to add a delay here or directory watchers may still pick up the changes -- cgit v1.2.3