mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-01 13:28:27 +01:00
replace file system calls with IFileSystem when needed
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.IO;
|
||||
@@ -321,6 +322,18 @@ namespace MediaBrowser.Server.Implementations.IO
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="FileSystemEventArgs" /> instance containing the event data.</param>
|
||||
void watcher_Changed(object sender, FileSystemEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
OnWatcherChanged(e);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.ErrorException("IOException in watcher changed", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnWatcherChanged(FileSystemEventArgs e)
|
||||
{
|
||||
var name = e.Name;
|
||||
|
||||
@@ -437,7 +450,7 @@ namespace MediaBrowser.Server.Implementations.IO
|
||||
|
||||
try
|
||||
{
|
||||
using (new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
|
||||
using (_fileSystem.GetFileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
|
||||
{
|
||||
//file is not locked
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user