aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-01-30 16:55:07 +0100
committerGitHub <noreply@github.com>2019-01-30 16:55:07 +0100
commitd0f2b3a747a015789326793d7b5f480748815f9b (patch)
tree15788fd4967e90039432b9036428b25200490ca8 /Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
parent08b63a7c11d5db9126c48e644b090223f86f0eb8 (diff)
parentffcf6bdd3aaad5068decf84b0400e433fdb8323c (diff)
Merge branch 'master' into startuptasks
Diffstat (limited to 'Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs')
-rw-r--r--Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs18
1 files changed, 9 insertions, 9 deletions
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
index 59c7c655f..90b43bc59 100644
--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
@@ -127,7 +127,7 @@ namespace Emby.Server.Implementations.AppBase
Logger.LogInformation("Saving system configuration");
var path = CommonApplicationPaths.SystemConfigurationFilePath;
- FileSystem.CreateDirectory(FileSystem.GetDirectoryName(path));
+ Directory.CreateDirectory(Path.GetDirectoryName(path));
lock (_configurationSyncLock)
{
@@ -197,7 +197,7 @@ namespace Emby.Server.Implementations.AppBase
&& !string.Equals(CommonConfiguration.CachePath ?? string.Empty, newPath))
{
// Validate
- if (!FileSystem.DirectoryExists(newPath))
+ if (!Directory.Exists(newPath))
{
throw new FileNotFoundException(string.Format("{0} does not exist.", newPath));
}
@@ -209,8 +209,7 @@ namespace Emby.Server.Implementations.AppBase
protected void EnsureWriteAccess(string path)
{
var file = Path.Combine(path, Guid.NewGuid().ToString());
-
- FileSystem.WriteAllText(file, string.Empty);
+ File.WriteAllText(file, string.Empty);
FileSystem.DeleteFile(file);
}
@@ -246,13 +245,14 @@ namespace Emby.Server.Implementations.AppBase
private object LoadConfiguration(string path, Type configurationType)
{
- try
+ if (!File.Exists(path))
{
- return XmlSerializer.DeserializeFromFile(configurationType, path);
+ return Activator.CreateInstance(configurationType);
}
- catch (FileNotFoundException)
+
+ try
{
- return Activator.CreateInstance(configurationType);
+ return XmlSerializer.DeserializeFromFile(configurationType, path);
}
catch (IOException)
{
@@ -293,7 +293,7 @@ namespace Emby.Server.Implementations.AppBase
_configurations.AddOrUpdate(key, configuration, (k, v) => configuration);
var path = GetConfigurationFile(key);
- FileSystem.CreateDirectory(FileSystem.GetDirectoryName(path));
+ Directory.CreateDirectory(Path.GetDirectoryName(path));
lock (_configurationSyncLock)
{