diff options
| author | Luke <luke.pulverenti@gmail.com> | 2013-05-20 07:12:25 -0700 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2013-05-20 07:12:25 -0700 |
| commit | e4d950e1a5313dd14b2618b761fa35f9f8c8ea1a (patch) | |
| tree | 4db45cde6c58a2907cf5916538620b034b22a959 | |
| parent | 549f82695063731209591042102b2aa2dd05cd51 (diff) | |
| parent | ac569421a98fed4b47dbff941f2ca29a773d188a (diff) | |
Merge pull request #292 from lalmanzar/master
Capitalising a collection
| -rw-r--r-- | MediaBrowser.Api/Library/LibraryHelpers.cs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs index 12b9d478f..ff0915d78 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); } |
