aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Library')
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs47
-rw-r--r--Emby.Server.Implementations/Library/UserManager.cs18
2 files changed, 31 insertions, 34 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index ad070ed79..9688ab385 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -395,38 +395,33 @@ namespace Emby.Server.Implementations.Library
foreach (var fileSystemInfo in item.GetDeletePaths().ToList())
{
- try
+ if (File.Exists(fileSystemInfo.FullName))
{
- _logger.LogDebug("Deleting path {path}", fileSystemInfo.FullName);
- if (fileSystemInfo.IsDirectory)
+ try
{
- _fileSystem.DeleteDirectory(fileSystemInfo.FullName, true);
+ _logger.LogDebug("Deleting path {path}", fileSystemInfo.FullName);
+ if (fileSystemInfo.IsDirectory)
+ {
+ _fileSystem.DeleteDirectory(fileSystemInfo.FullName, true);
+ }
+ else
+ {
+ _fileSystem.DeleteFile(fileSystemInfo.FullName);
+ }
}
- else
+ catch (IOException)
{
- _fileSystem.DeleteFile(fileSystemInfo.FullName);
+ if (isRequiredForDelete)
+ {
+ throw;
+ }
}
- }
- catch (FileNotFoundException)
- {
- // may have already been deleted manually by user
- }
- catch (DirectoryNotFoundException)
- {
- // may have already been deleted manually by user
- }
- catch (IOException)
- {
- if (isRequiredForDelete)
- {
- throw;
- }
- }
- catch (UnauthorizedAccessException)
- {
- if (isRequiredForDelete)
+ catch (UnauthorizedAccessException)
{
- throw;
+ if (isRequiredForDelete)
+ {
+ throw;
+ }
}
}
diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs
index 6139659b7..d6f844650 100644
--- a/Emby.Server.Implementations/Library/UserManager.cs
+++ b/Emby.Server.Implementations/Library/UserManager.cs
@@ -1029,6 +1029,11 @@ namespace Emby.Server.Implementations.Library
{
var path = GetPolicyFilePath(user);
+ if (!File.Exists(path))
+ {
+ return GetDefaultPolicy(user);
+ }
+
try
{
lock (_policySyncLock)
@@ -1036,10 +1041,6 @@ namespace Emby.Server.Implementations.Library
return (UserPolicy)_xmlSerializer.DeserializeFromFile(typeof(UserPolicy), path);
}
}
- catch (FileNotFoundException)
- {
- return GetDefaultPolicy(user);
- }
catch (IOException)
{
return GetDefaultPolicy(user);
@@ -1128,6 +1129,11 @@ namespace Emby.Server.Implementations.Library
{
var path = GetConfigurationFilePath(user);
+ if (!File.Exists(path))
+ {
+ return new UserConfiguration();
+ }
+
try
{
lock (_configSyncLock)
@@ -1135,10 +1141,6 @@ namespace Emby.Server.Implementations.Library
return (UserConfiguration)_xmlSerializer.DeserializeFromFile(typeof(UserConfiguration), path);
}
}
- catch (FileNotFoundException)
- {
- return new UserConfiguration();
- }
catch (IOException)
{
return new UserConfiguration();