diff options
| author | Luis Miguel Almánzar <ruisu15@gmail.com> | 2013-05-20 01:45:54 -0400 |
|---|---|---|
| committer | Luis Miguel Almánzar <ruisu15@gmail.com> | 2013-05-20 01:45:54 -0400 |
| commit | ac569421a98fed4b47dbff941f2ca29a773d188a (patch) | |
| tree | 60e5352d043b78e7c1da08b9475f9ec3cc114526 | |
| parent | 7b3edb8737fed4b73fe080ca12b655703b331508 (diff) | |
Fix move condition
| -rw-r--r-- | MediaBrowser.Api/Library/LibraryHelpers.cs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs index 67e1160f7..ff0915d78 100644 --- a/MediaBrowser.Api/Library/LibraryHelpers.cs +++ b/MediaBrowser.Api/Library/LibraryHelpers.cs @@ -77,12 +77,18 @@ namespace MediaBrowser.Api.Library 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); } |
