aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Library/LibraryHelpers.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/Library/LibraryHelpers.cs')
-rw-r--r--MediaBrowser.Api/Library/LibraryHelpers.cs9
1 files changed, 9 insertions, 0 deletions
diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs
index 12b9d478ff..ff0915d78f 100644
--- a/MediaBrowser.Api/Library/LibraryHelpers.cs
+++ b/MediaBrowser.Api/Library/LibraryHelpers.cs
@@ -79,6 +79,15 @@ namespace MediaBrowser.Api.Library
{
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);
}