aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
diff options
context:
space:
mode:
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 ff35b3205..460809e93 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)
{