Unwrapped MoveDirectory, DirectoryExists, FileExists & removed MoveFile

This commit is contained in:
Erwin de Haan 2019-01-26 22:59:53 +01:00
parent a430568082
commit 581a7fe078
38 changed files with 89 additions and 87 deletions

View File

@ -150,7 +150,7 @@ namespace BDInfo
Is3D = true;
}
if (_fileSystem.FileExists(Path.Combine(DirectoryRoot.FullName, "FilmIndex.xml")))
if (File.Exists(Path.Combine(DirectoryRoot.FullName, "FilmIndex.xml")))
{
IsDBOX = true;
}

View File

@ -244,7 +244,7 @@ namespace Emby.Drawing
try
{
if (!_fileSystem.FileExists(cacheFilePath))
if (!File.Exists(cacheFilePath))
{
if (options.CropWhiteSpace && !SupportsTransparency(originalImagePath))
{
@ -626,7 +626,7 @@ namespace Emby.Drawing
try
{
// Check again in case of contention
if (_fileSystem.FileExists(enhancedImagePath))
if (File.Exists(enhancedImagePath))
{
return (enhancedImagePath, treatmentRequiresTransparency);
}

View File

@ -214,7 +214,7 @@ namespace IsoMounter
{
string path = test.Trim();
if (!string.IsNullOrEmpty(path) && FileSystem.FileExists(path = Path.Combine(path, name)))
if (!string.IsNullOrEmpty(path) && File.Exists(path = Path.Combine(path, name)))
{
return Path.GetFullPath(path);
}

View File

@ -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));
}

View File

@ -1008,7 +1008,7 @@ namespace Emby.Server.Implementations
try
{
if (!FileSystemManager.FileExists(certificateLocation))
if (!File.Exists(certificateLocation))
{
return null;
}
@ -1434,7 +1434,7 @@ namespace Emby.Server.Implementations
//if (generateCertificate)
//{
// if (!FileSystemManager.FileExists(certPath))
// if (!File.Exists(certPath))
// {
// FileSystemManager.CreateDirectory(FileSystemManager.GetDirectoryName(certPath));

View File

@ -359,7 +359,7 @@ namespace Emby.Server.Implementations.Collections
{
var path = _collectionManager.GetCollectionsFolderPath();
if (_fileSystem.DirectoryExists(path))
if (Directory.Exists(path))
{
try
{

View File

@ -148,7 +148,7 @@ namespace Emby.Server.Implementations.Configuration
&& !string.Equals(Configuration.CertificatePath ?? string.Empty, newPath))
{
// Validate
if (!FileSystem.FileExists(newPath))
if (!File.Exists(newPath))
{
throw new FileNotFoundException(string.Format("Certificate file '{0}' does not exist.", newPath));
}
@ -168,7 +168,7 @@ namespace Emby.Server.Implementations.Configuration
&& !string.Equals(Configuration.MetadataPath ?? string.Empty, newPath))
{
// Validate
if (!FileSystem.DirectoryExists(newPath))
if (!Directory.Exists(newPath))
{
throw new FileNotFoundException(string.Format("{0} does not exist.", newPath));
}

View File

@ -431,7 +431,7 @@ namespace Emby.Server.Implementations.Devices
{
var path = _deviceManager.GetUploadsPath();
if (_fileSystem.DirectoryExists(path))
if (Directory.Exists(path))
{
try
{

View File

@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.FFMpeg
var prebuiltFolder = _appPaths.ProgramSystemPath;
var prebuiltffmpeg = Path.Combine(prebuiltFolder, downloadInfo.FFMpegFilename);
var prebuiltffprobe = Path.Combine(prebuiltFolder, downloadInfo.FFProbeFilename);
if (_fileSystem.FileExists(prebuiltffmpeg) && _fileSystem.FileExists(prebuiltffprobe))
if (File.Exists(prebuiltffmpeg) && File.Exists(prebuiltffprobe))
{
return new FFMpegInfo
{
@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.FFMpeg
var excludeFromDeletions = new List<string> { versionedDirectoryPath };
if (!_fileSystem.FileExists(info.ProbePath) || !_fileSystem.FileExists(info.EncoderPath))
if (!File.Exists(info.ProbePath) || !File.Exists(info.EncoderPath))
{
// ffmpeg not present. See if there's an older version we can start with
var existingVersion = GetExistingVersion(info, rootEncoderPath);

View File

@ -195,7 +195,7 @@ namespace Emby.Server.Implementations.IO
if (item != null)
{
// If the item has been deleted find the first valid parent that still exists
while (!_fileSystem.DirectoryExists(item.Path) && !_fileSystem.FileExists(item.Path))
while (!Directory.Exists(item.Path) && !File.Exists(item.Path))
{
item = item.GetOwner() ?? item.GetParent();

View File

@ -277,7 +277,7 @@ namespace Emby.Server.Implementations.IO
/// <param name="path">The path.</param>
private void StartWatchingPath(string path)
{
if (!_fileSystem.DirectoryExists(path))
if (!Directory.Exists(path))
{
// Seeing a crash in the mono runtime due to an exception being thrown on a different thread
Logger.LogInformation("Skipping realtime monitor for {0} because the path does not exist", path);

View File

@ -2863,7 +2863,7 @@ namespace Emby.Server.Implementations.Library
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
var virtualFolderPath = Path.Combine(rootFolderPath, name);
while (_fileSystem.DirectoryExists(virtualFolderPath))
while (Directory.Exists(virtualFolderPath))
{
name += "1";
virtualFolderPath = Path.Combine(rootFolderPath, name);
@ -2872,7 +2872,7 @@ namespace Emby.Server.Implementations.Library
var mediaPathInfos = options.PathInfos;
if (mediaPathInfos != null)
{
var invalidpath = mediaPathInfos.FirstOrDefault(i => !_fileSystem.DirectoryExists(i.Path));
var invalidpath = mediaPathInfos.FirstOrDefault(i => !Directory.Exists(i.Path));
if (invalidpath != null)
{
throw new ArgumentException("The specified path does not exist: " + invalidpath.Path + ".");
@ -2935,7 +2935,7 @@ namespace Emby.Server.Implementations.Library
// // We can't validate protocol-based paths, so just allow them
// if (path.IndexOf("://", StringComparison.OrdinalIgnoreCase) == -1)
// {
// return _fileSystem.DirectoryExists(path);
// return Directory.Exists(path);
// }
//}
@ -2963,7 +2963,7 @@ namespace Emby.Server.Implementations.Library
throw new ArgumentNullException(nameof(path));
}
if (!_fileSystem.DirectoryExists(path))
if (!Directory.Exists(path))
{
throw new FileNotFoundException("The path does not exist.");
}
@ -2980,7 +2980,7 @@ namespace Emby.Server.Implementations.Library
var lnk = Path.Combine(virtualFolderPath, shortcutFilename + ShortcutFileExtension);
while (_fileSystem.FileExists(lnk))
while (File.Exists(lnk))
{
shortcutFilename += "1";
lnk = Path.Combine(virtualFolderPath, shortcutFilename + ShortcutFileExtension);
@ -3073,7 +3073,7 @@ namespace Emby.Server.Implementations.Library
var path = Path.Combine(rootFolderPath, name);
if (!_fileSystem.DirectoryExists(path))
if (!Directory.Exists(path))
{
throw new FileNotFoundException("The media folder does not exist");
}
@ -3145,7 +3145,7 @@ namespace Emby.Server.Implementations.Library
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName);
if (!_fileSystem.DirectoryExists(virtualFolderPath))
if (!Directory.Exists(virtualFolderPath))
{
throw new FileNotFoundException(string.Format("The media collection {0} does not exist", virtualFolderName));
}

View File

@ -1427,7 +1427,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
timer.RetryCount++;
_timerProvider.AddOrUpdate(timer);
}
else if (_fileSystem.FileExists(recordPath))
else if (File.Exists(recordPath))
{
timer.RecordingPath = recordPath;
timer.Status = RecordingStatus.Completed;
@ -1573,7 +1573,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
.Where(i => i.Status == RecordingStatus.Completed && !string.IsNullOrWhiteSpace(i.RecordingPath))
.Where(i => string.Equals(i.SeriesTimerId, seriesTimerId, StringComparison.OrdinalIgnoreCase))
.OrderByDescending(i => i.EndDate)
.Where(i => _fileSystem.FileExists(i.RecordingPath))
.Where(i => File.Exists(i.RecordingPath))
.Skip(seriesTimer.KeepUpTo - 1)
.ToList();
@ -1595,7 +1595,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
DtoOptions = new DtoOptions(true)
}))
.Where(i => i.IsFileProtocol && _fileSystem.FileExists(i.Path))
.Where(i => i.IsFileProtocol && File.Exists(i.Path))
.Skip(seriesTimer.KeepUpTo - 1)
.ToList();
@ -1689,7 +1689,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private bool FileExists(string path, string timerId)
{
if (_fileSystem.FileExists(path))
if (File.Exists(path))
{
return true;
}
@ -1961,7 +1961,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
var nfoPath = Path.Combine(seriesPath, "tvshow.nfo");
if (_fileSystem.FileExists(nfoPath))
if (File.Exists(nfoPath))
{
return;
}
@ -2023,7 +2023,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
var nfoPath = Path.ChangeExtension(recordingPath, ".nfo");
if (_fileSystem.FileExists(nfoPath))
if (File.Exists(nfoPath))
{
return;
}
@ -2688,7 +2688,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var defaultFolder = RecordingPath;
var defaultName = "Recordings";
if (_fileSystem.DirectoryExists(defaultFolder))
if (Directory.Exists(defaultFolder))
{
list.Add(new VirtualFolderInfo
{
@ -2698,7 +2698,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
var customPath = GetConfiguration().MovieRecordingPath;
if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && _fileSystem.DirectoryExists(customPath))
if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && Directory.Exists(customPath))
{
list.Add(new VirtualFolderInfo
{
@ -2709,7 +2709,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
customPath = GetConfiguration().SeriesRecordingPath;
if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && _fileSystem.DirectoryExists(customPath))
if ((!string.IsNullOrWhiteSpace(customPath) && !string.Equals(customPath, defaultFolder, StringComparison.OrdinalIgnoreCase)) && Directory.Exists(customPath))
{
list.Add(new VirtualFolderInfo
{

View File

@ -61,7 +61,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
string cacheFilename = DateTime.UtcNow.DayOfYear.ToString(CultureInfo.InvariantCulture) + "-" + DateTime.UtcNow.Hour.ToString(CultureInfo.InvariantCulture) + ".xml";
string cacheFile = Path.Combine(_config.ApplicationPaths.CachePath, "xmltv", cacheFilename);
if (_fileSystem.FileExists(cacheFile))
if (File.Exists(cacheFile))
{
return UnzipIfNeeded(path, cacheFile);
}
@ -255,7 +255,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
public Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings)
{
// Assume all urls are valid. check files for existence
if (!info.Path.StartsWith("http", StringComparison.OrdinalIgnoreCase) && !_fileSystem.FileExists(info.Path))
if (!info.Path.StartsWith("http", StringComparison.OrdinalIgnoreCase) && !File.Exists(info.Path))
{
throw new FileNotFoundException("Could not find the XmlTv file specified:", info.Path);
}

View File

@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.Playlists
private string GetTargetPath(string path)
{
while (_fileSystem.DirectoryExists(path))
while (Directory.Exists(path))
{
path += "1";
}

View File

@ -257,7 +257,7 @@ namespace Jellyfin.Drawing.Skia
internal static SKBitmap Decode(string path, bool forceCleanBitmap, IFileSystem fileSystem, ImageOrientation? orientation, out SKEncodedOrigin origin)
{
if (!fileSystem.FileExists(path))
if (!File.Exists(path))
{
throw new FileNotFoundException("File not found", path);
}

View File

@ -137,14 +137,14 @@ namespace MediaBrowser.Api
{
if (request.IsFile.Value)
{
if (!_fileSystem.FileExists(request.Path))
if (!File.Exists(request.Path))
{
throw new FileNotFoundException("File not found", request.Path);
}
}
else
{
if (!_fileSystem.DirectoryExists(request.Path))
if (Directory.Exists(request.Path))
{
throw new FileNotFoundException("File not found", request.Path);
}
@ -153,7 +153,7 @@ namespace MediaBrowser.Api
else
{
if (!_fileSystem.FileExists(request.Path) && !_fileSystem.DirectoryExists(request.Path))
if (!File.Exists(request.Path) && Directory.Exists(request.Path))
{
throw new FileNotFoundException("Path not found", request.Path);
}

View File

@ -185,7 +185,7 @@ namespace MediaBrowser.Api.Images
var paths = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(_appPaths.GeneralPath, request.Name, filename + i)).ToList();
var path = paths.FirstOrDefault(_fileSystem.FileExists) ?? paths.FirstOrDefault();
var path = paths.FirstOrDefault(File.Exists) ?? paths.FirstOrDefault();
return _resultFactory.GetStaticFileResult(Request, path);
}
@ -199,11 +199,11 @@ namespace MediaBrowser.Api.Images
{
var themeFolder = Path.Combine(_appPaths.RatingsPath, request.Theme);
if (_fileSystem.DirectoryExists(themeFolder))
if (Directory.Exists(themeFolder))
{
var path = BaseItem.SupportedImageExtensions
.Select(i => Path.Combine(themeFolder, request.Name + i))
.FirstOrDefault(_fileSystem.FileExists);
.FirstOrDefault(File.Exists);
if (!string.IsNullOrEmpty(path))
{
@ -213,14 +213,14 @@ namespace MediaBrowser.Api.Images
var allFolder = Path.Combine(_appPaths.RatingsPath, "all");
if (_fileSystem.DirectoryExists(allFolder))
if (Directory.Exists(allFolder))
{
// Avoid implicitly captured closure
var currentRequest = request;
var path = BaseItem.SupportedImageExtensions
.Select(i => Path.Combine(allFolder, currentRequest.Name + i))
.FirstOrDefault(_fileSystem.FileExists);
.FirstOrDefault(File.Exists);
if (!string.IsNullOrEmpty(path))
{
@ -240,10 +240,10 @@ namespace MediaBrowser.Api.Images
{
var themeFolder = Path.Combine(_appPaths.MediaInfoImagesPath, request.Theme);
if (_fileSystem.DirectoryExists(themeFolder))
if (Directory.Exists(themeFolder))
{
var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(themeFolder, request.Name + i))
.FirstOrDefault(_fileSystem.FileExists);
.FirstOrDefault(File.Exists);
if (!string.IsNullOrEmpty(path))
{
@ -253,13 +253,13 @@ namespace MediaBrowser.Api.Images
var allFolder = Path.Combine(_appPaths.MediaInfoImagesPath, "all");
if (_fileSystem.DirectoryExists(allFolder))
if (Directory.Exists(allFolder))
{
// Avoid implicitly captured closure
var currentRequest = request;
var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(allFolder, currentRequest.Name + i))
.FirstOrDefault(_fileSystem.FileExists);
.FirstOrDefault(File.Exists);
if (!string.IsNullOrEmpty(path))
{

View File

@ -222,7 +222,7 @@ namespace MediaBrowser.Api.Images
{
contentPath = _fileSystem.ReadAllText(pointerCachePath);
if (_fileSystem.FileExists(contentPath))
if (File.Exists(contentPath))
{
return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);
}

View File

@ -267,7 +267,7 @@ namespace MediaBrowser.Api
{
contentPath = _fileSystem.ReadAllText(pointerCachePath);
if (_fileSystem.FileExists(contentPath))
if (File.Exists(contentPath))
{
return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);
}

View File

@ -255,12 +255,12 @@ namespace MediaBrowser.Api.Library
var currentPath = Path.Combine(rootFolderPath, request.Name);
var newPath = Path.Combine(rootFolderPath, request.NewName);
if (!_fileSystem.DirectoryExists(currentPath))
if (Directory.Exists(currentPath))
{
throw new FileNotFoundException("The media collection does not exist");
}
if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && _fileSystem.DirectoryExists(newPath))
if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && Directory.Exists(newPath))
{
throw new ArgumentException("Media library already exists at " + newPath + ".");
}
@ -273,11 +273,11 @@ namespace MediaBrowser.Api.Library
if (string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase))
{
var tempPath = Path.Combine(rootFolderPath, Guid.NewGuid().ToString("N"));
_fileSystem.MoveDirectory(currentPath, tempPath);
Directory.Move(currentPath, tempPath);
currentPath = tempPath;
}
_fileSystem.MoveDirectory(currentPath, newPath);
Directory.Move(currentPath, newPath);
}
finally
{

View File

@ -290,7 +290,7 @@ namespace MediaBrowser.Api.Playback
new JobLogger(Logger).StartStreamingLog(state, process.StandardError.BaseStream, state.LogFileStream);
// Wait for the file to exist before proceeeding
while (!FileSystem.FileExists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)
while (!File.Exists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)
{
await Task.Delay(100, cancellationTokenSource.Token).ConfigureAwait(false);
}

View File

@ -83,13 +83,13 @@ namespace MediaBrowser.Api.Playback.Hls
TranscodingJob job = null;
var playlist = state.OutputFilePath;
if (!FileSystem.FileExists(playlist))
if (!File.Exists(playlist))
{
var transcodingLock = ApiEntryPoint.Instance.GetTranscodingLock(playlist);
await transcodingLock.WaitAsync(cancellationTokenSource.Token).ConfigureAwait(false);
try
{
if (!FileSystem.FileExists(playlist))
if (!File.Exists(playlist))
{
// If the playlist doesn't already exist, startup ffmpeg
try

View File

@ -164,7 +164,7 @@ namespace MediaBrowser.Api.Playback.Hls
TranscodingJob job = null;
if (FileSystem.FileExists(segmentPath))
if (File.Exists(segmentPath))
{
job = ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);
return await GetSegmentResult(state, playlistPath, segmentPath, segmentExtension, requestedIndex, job, cancellationToken).ConfigureAwait(false);
@ -177,7 +177,7 @@ namespace MediaBrowser.Api.Playback.Hls
try
{
if (FileSystem.FileExists(segmentPath))
if (File.Exists(segmentPath))
{
job = ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);
transcodingLock.Release();
@ -433,7 +433,7 @@ namespace MediaBrowser.Api.Playback.Hls
TranscodingJob transcodingJob,
CancellationToken cancellationToken)
{
var segmentFileExists = FileSystem.FileExists(segmentPath);
var segmentFileExists = File.Exists(segmentPath);
// If all transcoding has completed, just return immediately
if (transcodingJob != null && transcodingJob.HasExited && segmentFileExists)
@ -465,7 +465,7 @@ namespace MediaBrowser.Api.Playback.Hls
{
if (!segmentFileExists)
{
segmentFileExists = FileSystem.FileExists(segmentPath);
segmentFileExists = File.Exists(segmentPath);
}
if (segmentFileExists)
{

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Net;
@ -153,7 +154,7 @@ namespace MediaBrowser.Api.Playback.Progressive
}
var outputPath = state.OutputFilePath;
var outputPathExists = FileSystem.FileExists(outputPath);
var outputPathExists = File.Exists(outputPath);
var transcodingJob = ApiEntryPoint.Instance.GetTranscodingJob(outputPath, TranscodingJobType.Progressive);
var isTranscodeCached = outputPathExists && transcodingJob != null;
@ -377,7 +378,7 @@ namespace MediaBrowser.Api.Playback.Progressive
{
TranscodingJob job;
if (!FileSystem.FileExists(outputPath))
if (!File.Exists(outputPath))
{
job = await StartFfMpeg(state, outputPath, cancellationTokenSource).ConfigureAwait(false);
}

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
@ -2343,7 +2344,7 @@ namespace MediaBrowser.Controller.Entities
var newImagePaths = images.Select(i => i.FullName).ToList();
var deleted = existingImages
.Where(i => i.IsLocalFile && !newImagePaths.Contains(i.Path, StringComparer.OrdinalIgnoreCase) && !FileSystem.FileExists(i.Path))
.Where(i => i.IsLocalFile && !newImagePaths.Contains(i.Path, StringComparer.OrdinalIgnoreCase) && !File.Exists(i.Path))
.ToList();
if (deleted.Count > 0)

View File

@ -168,14 +168,14 @@ namespace MediaBrowser.Controller.Entities
var oldConfigurationDirectory = ConfigurationDirectoryPath;
// Exceptions will be thrown if these paths already exist
if (FileSystem.DirectoryExists(newConfigDirectory))
if (Directory.Exists(newConfigDirectory))
{
Directory.Delete(newConfigDirectory, true);
}
if (FileSystem.DirectoryExists(oldConfigurationDirectory))
if (Directory.Exists(oldConfigurationDirectory))
{
FileSystem.MoveDirectory(oldConfigurationDirectory, newConfigDirectory);
Directory.Move(oldConfigurationDirectory, newConfigDirectory);
}
else
{

View File

@ -434,7 +434,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (string.Equals(Path.GetExtension(subtitlePath), ".sub", StringComparison.OrdinalIgnoreCase))
{
var idxFile = Path.ChangeExtension(subtitlePath, ".idx");
if (_fileSystem.FileExists(idxFile))
if (File.Exists(idxFile))
{
subtitlePath = idxFile;
}
@ -542,7 +542,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// var fallbackFontPath = Path.Combine(_appPaths.ProgramDataPath, "fonts", "DroidSansFallback.ttf");
// string fallbackFontParam = string.Empty;
// if (!_fileSystem.FileExists(fallbackFontPath))
// if (!File.Exists(fallbackFontPath))
// {
// _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fallbackFontPath));
// using (var stream = _assemblyInfo.GetManifestResourceStream(GetType(), GetType().Namespace + ".DroidSansFallback.ttf"))

View File

@ -46,7 +46,7 @@ namespace MediaBrowser.MediaEncoding.Configuration
&& !string.Equals(oldEncodingConfig.TranscodingTempPath ?? string.Empty, newPath))
{
// Validate
if (!_fileSystem.DirectoryExists(newPath))
if (Directory.Exists(newPath))
{
throw new FileNotFoundException(string.Format("{0} does not exist.", newPath));
}

View File

@ -137,7 +137,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
new JobLogger(Logger).StartStreamingLog(encodingJob, process.StandardError.BaseStream, encodingJob.LogFileStream);
// Wait for the file to exist before proceeeding
while (!FileSystem.FileExists(encodingJob.OutputFilePath) && !encodingJob.HasExited)
while (!File.Exists(encodingJob.OutputFilePath) && !encodingJob.HasExited)
{
await Task.Delay(100, cancellationToken).ConfigureAwait(false);
}

View File

@ -214,7 +214,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
throw new ArgumentNullException(nameof(path));
}
if (!FileSystem.FileExists(path) && !FileSystem.DirectoryExists(path))
if (!File.Exists(path) && Directory.Exists(path))
{
throw new ResourceNotFoundException();
}
@ -288,12 +288,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
if (!string.IsNullOrWhiteSpace(appPath))
{
if (FileSystem.DirectoryExists(appPath))
if (Directory.Exists(appPath))
{
return GetPathsFromDirectory(appPath);
}
if (FileSystem.FileExists(appPath))
if (File.Exists(appPath))
{
return new Tuple<string, string>(appPath, GetProbePathFromEncoderPath(appPath));
}
@ -336,7 +336,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
var ffmpegPath = files.FirstOrDefault(i => string.Equals(Path.GetFileNameWithoutExtension(i), "ffmpeg", StringComparison.OrdinalIgnoreCase) && !excludeExtensions.Contains(Path.GetExtension(i) ?? string.Empty));
var ffprobePath = files.FirstOrDefault(i => string.Equals(Path.GetFileNameWithoutExtension(i), "ffprobe", StringComparison.OrdinalIgnoreCase) && !excludeExtensions.Contains(Path.GetExtension(i) ?? string.Empty));
if (string.IsNullOrWhiteSpace(ffmpegPath) || !FileSystem.FileExists(ffmpegPath))
if (string.IsNullOrWhiteSpace(ffmpegPath) || !File.Exists(ffmpegPath))
{
files = FileSystem.GetFilePaths(path, true);

View File

@ -386,7 +386,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
try
{
if (!_fileSystem.FileExists(outputPath))
if (!File.Exists(outputPath))
{
await ConvertTextSubtitleToSrtInternal(inputPath, language, inputProtocol, outputPath, cancellationToken).ConfigureAwait(false);
}
@ -481,7 +481,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
failed = true;
if (_fileSystem.FileExists(outputPath))
if (File.Exists(outputPath))
{
try
{
@ -494,7 +494,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
}
}
}
else if (!_fileSystem.FileExists(outputPath))
else if (!File.Exists(outputPath))
{
failed = true;
}
@ -537,7 +537,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
try
{
if (!_fileSystem.FileExists(outputPath))
if (!File.Exists(outputPath))
{
await ExtractTextSubtitleInternal(_mediaEncoder.GetInputArgument(inputFiles, protocol), subtitleStreamIndex, outputCodec, outputPath, cancellationToken).ConfigureAwait(false);
}
@ -634,7 +634,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
_logger.LogError(ex, "Error deleting extracted subtitle {Path}", outputPath);
}
}
else if (!_fileSystem.FileExists(outputPath))
else if (!File.Exists(outputPath))
{
failed = true;
}

View File

@ -387,7 +387,7 @@ namespace MediaBrowser.Providers.Manager
var existing = item.GetImageInfo(type, 0);
if (existing != null)
{
if (existing.IsLocalFile && !_fileSystem.FileExists(existing.Path))
if (existing.IsLocalFile && !File.Exists(existing.Path))
{
item.RemoveImage(existing);
changed = true;

View File

@ -703,7 +703,7 @@ namespace MediaBrowser.Providers.Manager
// Manual edit occurred
// Even if save local is off, save locally anyway if the metadata file already exists
if (fileSaver == null || !_fileSystem.FileExists(fileSaver.GetSavePath(item)))
if (fileSaver == null || !File.Exists(fileSaver.GetSavePath(item)))
{
return false;
}

View File

@ -58,7 +58,7 @@ namespace MediaBrowser.Providers.MediaInfo
{
var path = GetAudioImagePath(item);
if (!_fileSystem.FileExists(path))
if (!File.Exists(path))
{
Directory.CreateDirectory(Path.GetDirectoryName(path));

View File

@ -58,7 +58,7 @@ namespace MediaBrowser.Providers.TV
}
// Check this in order to avoid logging an exception due to directory not existing
if (!_fileSystem.DirectoryExists(seriesDataPath))
if (Directory.Exists(seriesDataPath))
{
return false;
}

View File

@ -1526,7 +1526,7 @@ namespace MediaBrowser.Providers.TV
var file = Path.Combine(seriesDataPath, string.Format("episode-{0}-{1}.xml", seasonNumber, episodeNumber));
// Only save the file if not already there, or if the episode has changed
if (hasEpisodeChanged || !_fileSystem.FileExists(file))
if (hasEpisodeChanged || !File.Exists(file))
{
using (var fileStream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true))
{
@ -1546,7 +1546,7 @@ namespace MediaBrowser.Providers.TV
file = Path.Combine(seriesDataPath, string.Format("episode-abs-{0}.xml", absoluteNumber));
// Only save the file if not already there, or if the episode has changed
if (hasEpisodeChanged || !_fileSystem.FileExists(file))
if (hasEpisodeChanged || !File.Exists(file))
{
using (var fileStream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true))
{
@ -1567,7 +1567,7 @@ namespace MediaBrowser.Providers.TV
file = Path.Combine(seriesDataPath, string.Format("episode-dvd-{0}-{1}.xml", dvdSeasonNumber, dvdEpisodeNumber));
// Only save the file if not already there, or if the episode has changed
if (hasEpisodeChanged || !_fileSystem.FileExists(file))
if (hasEpisodeChanged || !File.Exists(file))
{
using (var fileStream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true))
{

View File

@ -36,7 +36,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
return false;
}
return updateType >= MinimumUpdateType || (updateType >= ItemUpdateType.MetadataImport && FileSystem.FileExists(GetSavePath(item)));
return updateType >= MinimumUpdateType || (updateType >= ItemUpdateType.MetadataImport && File.Exists(GetSavePath(item)));
}
protected override void WriteCustomElements(BaseItem item, XmlWriter writer)