From 4b886ea93f3a9c295ff1da36a6cdf33c677de5e5 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 4 Nov 2013 11:26:49 -0500 Subject: fix multiple scan restarts when renaming collection --- MediaBrowser.Api/Library/LibraryHelpers.cs | 38 ------------------------------ 1 file changed, 38 deletions(-) (limited to 'MediaBrowser.Api/Library/LibraryHelpers.cs') diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs index 8f6dcfc0d..d16250ce9 100644 --- a/MediaBrowser.Api/Library/LibraryHelpers.cs +++ b/MediaBrowser.Api/Library/LibraryHelpers.cs @@ -21,44 +21,6 @@ namespace MediaBrowser.Api.Library /// private const string ShortcutFileSearch = "*" + ShortcutFileExtension; - /// - /// Renames the virtual folder. - /// - /// The name. - /// The new name. - /// The user. - /// The app paths. - /// The media collection does not exist - /// There is already a media collection with the name + newPath + . - public static void RenameVirtualFolder(string name, string newName, User user, IServerApplicationPaths appPaths) - { - var rootFolderPath = user != null ? user.RootFolderPath : appPaths.DefaultUserViewsPath; - - var currentPath = Path.Combine(rootFolderPath, name); - var newPath = Path.Combine(rootFolderPath, newName); - - if (!Directory.Exists(currentPath)) - { - throw new DirectoryNotFoundException("The media collection does not exist"); - } - - if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && Directory.Exists(newPath)) - { - throw new ArgumentException("There is already a media collection with the name " + newPath + "."); - } - //Only make a two-phase move when changing capitalization - if (string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase)) - { - //Create an unique name - var temporaryName = Guid.NewGuid().ToString(); - var temporaryPath = Path.Combine(rootFolderPath, temporaryName); - Directory.Move(currentPath,temporaryPath); - currentPath = temporaryPath; - } - - Directory.Move(currentPath, newPath); - } - /// /// Deletes a shortcut from within a virtual folder, within either the default view or a user view /// -- cgit v1.2.3