2
0
Эх сурвалжийг харах

Merge pull request #292 from lalmanzar/master

Capitalising a collection
Luke 12 жил өмнө
parent
commit
e4d950e1a5

+ 9 - 0
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 + ".");
                 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);
             Directory.Move(currentPath, newPath);
         }
         }