mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-19 00:26:25 +00:00
add more methods to IFileSystem
This commit is contained in:
@@ -19,7 +19,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="xmlSerializer">The XML serializer.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public static object GetXmlConfiguration(Type type, string path, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
|
||||
public static object GetXmlConfiguration(Type type, string path, IXmlSerializer xmlSerializer)
|
||||
{
|
||||
object configuration;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
||||
// Use try/catch to avoid the extra file system lookup using File.Exists
|
||||
try
|
||||
{
|
||||
buffer = fileSystem.ReadAllBytes(path);
|
||||
buffer = File.ReadAllBytes(path);
|
||||
|
||||
configuration = xmlSerializer.DeserializeFromBytes(type, buffer);
|
||||
}
|
||||
@@ -47,10 +47,10 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
||||
// If the file didn't exist before, or if something has changed, re-save
|
||||
if (buffer == null || !buffer.SequenceEqual(newBytes))
|
||||
{
|
||||
fileSystem.CreateDirectory(Path.GetDirectoryName(path));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
// Save it after load in case we got new items
|
||||
fileSystem.WriteAllBytes(path, newBytes);
|
||||
File.WriteAllBytes(path, newBytes);
|
||||
}
|
||||
|
||||
return configuration;
|
||||
|
||||
Reference in New Issue
Block a user