Unwrapped GetDirectoryName and DirectorySeperatorChar

This commit is contained in:
Erwin de Haan 2019-01-26 21:47:11 +01:00
parent a05d803d4c
commit 3a831994f6
73 changed files with 119 additions and 114 deletions

View File

@ -92,7 +92,7 @@ namespace BDInfo
} }
DirectoryRoot = DirectoryRoot =
_fileSystem.GetDirectoryInfo(_fileSystem.GetDirectoryName(DirectoryBDMV.FullName)); _fileSystem.GetDirectoryInfo(Path.GetDirectoryName(DirectoryBDMV.FullName));
DirectoryBDJO = DirectoryBDJO =
GetDirectory("BDJO", DirectoryBDMV, 0); GetDirectory("BDJO", DirectoryBDMV, 0);
DirectoryCLIPINF = DirectoryCLIPINF =
@ -345,7 +345,7 @@ namespace BDInfo
{ {
return dir; return dir;
} }
var parentFolder = _fileSystem.GetDirectoryName(dir.FullName); var parentFolder = Path.GetDirectoryName(dir.FullName);
if (string.IsNullOrEmpty(parentFolder)) if (string.IsNullOrEmpty(parentFolder))
{ {
dir = null; dir = null;

View File

@ -631,7 +631,7 @@ namespace Emby.Drawing
return (enhancedImagePath, treatmentRequiresTransparency); return (enhancedImagePath, treatmentRequiresTransparency);
} }
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(enhancedImagePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(enhancedImagePath));
await ExecuteImageEnhancers(supportedEnhancers, originalImagePath, enhancedImagePath, item, imageType, imageIndex).ConfigureAwait(false); await ExecuteImageEnhancers(supportedEnhancers, originalImagePath, enhancedImagePath, item, imageType, imageIndex).ConfigureAwait(false);

View File

@ -39,7 +39,7 @@ namespace IsoMounter
_logger = logger; _logger = logger;
ProcessFactory = processFactory; ProcessFactory = processFactory;
MountPointRoot = FileSystem.DirectorySeparatorChar + "tmp" + FileSystem.DirectorySeparatorChar + "Emby"; MountPointRoot = Path.DirectorySeparatorChar + "tmp" + Path.DirectorySeparatorChar + "Emby";
_logger.LogDebug( _logger.LogDebug(
"[{0}] System PATH is currently set to [{1}].", "[{0}] System PATH is currently set to [{1}].",
@ -216,7 +216,7 @@ namespace IsoMounter
if (!string.IsNullOrEmpty(path) && FileSystem.FileExists(path = Path.Combine(path, name))) if (!string.IsNullOrEmpty(path) && FileSystem.FileExists(path = Path.Combine(path, name)))
{ {
return FileSystem.GetFullPath(path); return Path.GetFullPath(path);
} }
} }

View File

@ -127,7 +127,7 @@ namespace Emby.Server.Implementations.AppBase
Logger.LogInformation("Saving system configuration"); Logger.LogInformation("Saving system configuration");
var path = CommonApplicationPaths.SystemConfigurationFilePath; var path = CommonApplicationPaths.SystemConfigurationFilePath;
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(path)); FileSystem.CreateDirectory(Path.GetDirectoryName(path));
lock (_configurationSyncLock) lock (_configurationSyncLock)
{ {
@ -294,7 +294,7 @@ namespace Emby.Server.Implementations.AppBase
_configurations.AddOrUpdate(key, configuration, (k, v) => configuration); _configurations.AddOrUpdate(key, configuration, (k, v) => configuration);
var path = GetConfigurationFile(key); var path = GetConfigurationFile(key);
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(path)); FileSystem.CreateDirectory(Path.GetDirectoryName(path));
lock (_configurationSyncLock) lock (_configurationSyncLock)
{ {

View File

@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.AppBase
// If the file didn't exist before, or if something has changed, re-save // If the file didn't exist before, or if something has changed, re-save
if (buffer == null || !buffer.SequenceEqual(newBytes)) if (buffer == null || !buffer.SequenceEqual(newBytes))
{ {
fileSystem.CreateDirectory(fileSystem.GetDirectoryName(path)); fileSystem.CreateDirectory(Path.GetDirectoryName(path));
// Save it after load in case we got new items // Save it after load in case we got new items
fileSystem.WriteAllBytes(path, newBytes); fileSystem.WriteAllBytes(path, newBytes);

View File

@ -355,7 +355,7 @@ namespace Emby.Server.Implementations.Channels
return; return;
} }
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
_jsonSerializer.SerializeToFile(mediaSources, path); _jsonSerializer.SerializeToFile(mediaSources, path);
} }
@ -834,7 +834,7 @@ namespace Emby.Server.Implementations.Channels
{ {
try try
{ {
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
_jsonSerializer.SerializeToFile(result, path); _jsonSerializer.SerializeToFile(result, path);
} }

View File

@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Devices
{ {
var path = CachePath; var path = CachePath;
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
lock (_syncLock) lock (_syncLock)
{ {

View File

@ -76,7 +76,7 @@ namespace Emby.Server.Implementations.Devices
public void SaveCapabilities(string deviceId, ClientCapabilities capabilities) public void SaveCapabilities(string deviceId, ClientCapabilities capabilities)
{ {
var path = Path.Combine(GetDevicePath(deviceId), "capabilities.json"); var path = Path.Combine(GetDevicePath(deviceId), "capabilities.json");
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
lock (_capabilitiesSyncLock) lock (_capabilitiesSyncLock)
{ {
@ -239,7 +239,7 @@ namespace Emby.Server.Implementations.Devices
path = Path.Combine(path, file.Name); path = Path.Combine(path, file.Name);
path = Path.ChangeExtension(path, MimeTypes.ToExtension(file.MimeType) ?? "jpg"); path = Path.ChangeExtension(path, MimeTypes.ToExtension(file.MimeType) ?? "jpg");
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
await EnsureLibraryFolder(uploadPathInfo.Item2, uploadPathInfo.Item3).ConfigureAwait(false); await EnsureLibraryFolder(uploadPathInfo.Item2, uploadPathInfo.Item3).ConfigureAwait(false);
@ -275,7 +275,7 @@ namespace Emby.Server.Implementations.Devices
private void AddCameraUpload(string deviceId, LocalFileInfo file) private void AddCameraUpload(string deviceId, LocalFileInfo file)
{ {
var path = Path.Combine(GetDevicePath(deviceId), "camerauploads.json"); var path = Path.Combine(GetDevicePath(deviceId), "camerauploads.json");
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
lock (_cameraUploadSyncLock) lock (_cameraUploadSyncLock)
{ {

View File

@ -92,7 +92,7 @@ namespace Emby.Server.Implementations.FFMpeg
else else
{ {
info = existingVersion; info = existingVersion;
versionedDirectoryPath = _fileSystem.GetDirectoryName(info.EncoderPath); versionedDirectoryPath = Path.GetDirectoryName(info.EncoderPath);
excludeFromDeletions.Add(versionedDirectoryPath); excludeFromDeletions.Add(versionedDirectoryPath);
} }
} }
@ -130,7 +130,7 @@ namespace Emby.Server.Implementations.FFMpeg
{ {
EncoderPath = encoder, EncoderPath = encoder,
ProbePath = probe, ProbePath = probe,
Version = Path.GetFileName(_fileSystem.GetDirectoryName(probe)) Version = Path.GetFileName(Path.GetDirectoryName(probe))
}; };
} }
} }

View File

@ -305,7 +305,7 @@ namespace Emby.Server.Implementations.HttpClientManager
private async Task CacheResponse(HttpResponseInfo response, string responseCachePath) private async Task CacheResponse(HttpResponseInfo response, string responseCachePath)
{ {
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(responseCachePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(responseCachePath));
using (var fileStream = _fileSystem.GetFileStream(responseCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true)) using (var fileStream = _fileSystem.GetFileStream(responseCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true))
{ {

View File

@ -189,7 +189,7 @@ namespace Emby.Server.Implementations.IO
{ {
item = LibraryManager.FindByPath(path, null); item = LibraryManager.FindByPath(path, null);
path = _fileSystem.GetDirectoryName(path); path = System.IO.Path.GetDirectoryName(path);
} }
if (item != null) if (item != null)

View File

@ -483,7 +483,7 @@ namespace Emby.Server.Implementations.IO
} }
// Go up a level // Go up a level
var parent = _fileSystem.GetDirectoryName(i); var parent = Path.GetDirectoryName(i);
if (!string.IsNullOrEmpty(parent)) if (!string.IsNullOrEmpty(parent))
{ {
if (_fileSystem.AreEqual(parent, path)) if (_fileSystem.AreEqual(parent, path))
@ -509,7 +509,7 @@ namespace Emby.Server.Implementations.IO
private void CreateRefresher(string path) private void CreateRefresher(string path)
{ {
var parentPath = _fileSystem.GetDirectoryName(path); var parentPath = Path.GetDirectoryName(path);
lock (_activeRefreshers) lock (_activeRefreshers)
{ {
@ -538,7 +538,7 @@ namespace Emby.Server.Implementations.IO
} }
// They are siblings. Rebase the refresher to the parent folder. // They are siblings. Rebase the refresher to the parent folder.
if (string.Equals(parentPath, _fileSystem.GetDirectoryName(refresher.Path), StringComparison.Ordinal)) if (string.Equals(parentPath, Path.GetDirectoryName(refresher.Path), StringComparison.Ordinal))
{ {
refresher.ResetPath(parentPath, path); refresher.ResetPath(parentPath, path);
return; return;

View File

@ -99,7 +99,7 @@ namespace Emby.Server.Implementations.Images
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var outputPathWithoutExtension = Path.Combine(ApplicationPaths.TempDirectory, Guid.NewGuid().ToString("N")); var outputPathWithoutExtension = Path.Combine(ApplicationPaths.TempDirectory, Guid.NewGuid().ToString("N"));
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(outputPathWithoutExtension)); FileSystem.CreateDirectory(Path.GetDirectoryName(outputPathWithoutExtension));
string outputPath = CreateImage(item, itemsWithImages, outputPathWithoutExtension, imageType, 0); string outputPath = CreateImage(item, itemsWithImages, outputPathWithoutExtension, imageType, 0);
if (string.IsNullOrEmpty(outputPath)) if (string.IsNullOrEmpty(outputPath))
@ -165,7 +165,7 @@ namespace Emby.Server.Implementations.Images
private string CreateCollage(BaseItem primaryItem, List<BaseItem> items, string outputPath, int width, int height) private string CreateCollage(BaseItem primaryItem, List<BaseItem> items, string outputPath, int width, int height)
{ {
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(outputPath)); FileSystem.CreateDirectory(Path.GetDirectoryName(outputPath));
var options = new ImageCollageOptions var options = new ImageCollageOptions
{ {

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
@ -146,7 +147,7 @@ namespace Emby.Server.Implementations.Library
if (parent != null) if (parent != null)
{ {
// Don't resolve these into audio files // Don't resolve these into audio files
if (string.Equals(_fileSystem.GetFileNameWithoutExtension(filename), BaseItem.ThemeSongFilename) && _libraryManager.IsAudioFile(filename)) if (string.Equals(Path.GetFileNameWithoutExtension(filename), BaseItem.ThemeSongFilename) && _libraryManager.IsAudioFile(filename))
{ {
return true; return true;
} }

View File

@ -1228,7 +1228,7 @@ namespace Emby.Server.Implementations.Library
private string GetCollectionType(string path) private string GetCollectionType(string path)
{ {
return _fileSystem.GetFilePaths(path, new[] { ".collection" }, true, false) return _fileSystem.GetFilePaths(path, new[] { ".collection" }, true, false)
.Select(i => _fileSystem.GetFileNameWithoutExtension(i)) .Select(i => Path.GetFileNameWithoutExtension(i))
.FirstOrDefault(i => !string.IsNullOrEmpty(i)); .FirstOrDefault(i => !string.IsNullOrEmpty(i));
} }
@ -2976,7 +2976,7 @@ namespace Emby.Server.Implementations.Library
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath; var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName); var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName);
var shortcutFilename = _fileSystem.GetFileNameWithoutExtension(path); var shortcutFilename = Path.GetFileNameWithoutExtension(path);
var lnk = Path.Combine(virtualFolderPath, shortcutFilename + ShortcutFileExtension); var lnk = Path.Combine(virtualFolderPath, shortcutFilename + ShortcutFileExtension);

View File

@ -670,7 +670,7 @@ namespace Emby.Server.Implementations.Library
if (cacheFilePath != null) if (cacheFilePath != null)
{ {
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(cacheFilePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(cacheFilePath));
_jsonSerializer.SerializeToFile(mediaInfo, cacheFilePath); _jsonSerializer.SerializeToFile(mediaInfo, cacheFilePath);
//_logger.LogDebug("Saved media info to {0}", cacheFilePath); //_logger.LogDebug("Saved media info to {0}", cacheFilePath);

View File

@ -43,7 +43,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
var filename = Path.GetFileNameWithoutExtension(args.Path); var filename = Path.GetFileNameWithoutExtension(args.Path);
// Make sure the image doesn't belong to a video file // Make sure the image doesn't belong to a video file
var files = args.DirectoryService.GetFiles(_fileSystem.GetDirectoryName(args.Path)); var files = args.DirectoryService.GetFiles(Path.GetDirectoryName(args.Path));
var libraryOptions = args.GetLibraryOptions(); var libraryOptions = args.GetLibraryOptions();
foreach (var file in files) foreach (var file in files)

View File

@ -1080,7 +1080,7 @@ namespace Emby.Server.Implementations.Library
var path = GetPolicyFilePath(user); var path = GetPolicyFilePath(user);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
lock (_policySyncLock) lock (_policySyncLock)
{ {
@ -1176,7 +1176,7 @@ namespace Emby.Server.Implementations.Library
config = _jsonSerializer.DeserializeFromString<UserConfiguration>(json); config = _jsonSerializer.DeserializeFromString<UserConfiguration>(json);
} }
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
lock (_configSyncLock) lock (_configSyncLock)
{ {

View File

@ -1,4 +1,5 @@
using System; using System;
using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
@ -41,7 +42,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private async Task RecordFromDirectStreamProvider(IDirectStreamProvider directStreamProvider, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken) private async Task RecordFromDirectStreamProvider(IDirectStreamProvider directStreamProvider, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken)
{ {
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(targetFile)); _fileSystem.CreateDirectory(Path.GetDirectoryName(targetFile));
using (var output = _fileSystem.GetFileStream(targetFile, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) using (var output = _fileSystem.GetFileStream(targetFile, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
{ {
@ -77,7 +78,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{ {
_logger.LogInformation("Opened recording stream from tuner provider"); _logger.LogInformation("Opened recording stream from tuner provider");
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(targetFile)); _fileSystem.CreateDirectory(Path.GetDirectoryName(targetFile));
using (var output = _fileSystem.GetFileStream(targetFile, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) using (var output = _fileSystem.GetFileStream(targetFile, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
{ {

View File

@ -1489,7 +1489,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{ {
_logger.LogInformation("Triggering refresh on {path}", path); _logger.LogInformation("Triggering refresh on {path}", path);
var item = GetAffectedBaseItem(_fileSystem.GetDirectoryName(path)); var item = GetAffectedBaseItem(Path.GetDirectoryName(path));
if (item != null) if (item != null)
{ {
@ -1500,8 +1500,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
RefreshPaths = new string[] RefreshPaths = new string[]
{ {
path, path,
_fileSystem.GetDirectoryName(path), Path.GetDirectoryName(path),
_fileSystem.GetDirectoryName(_fileSystem.GetDirectoryName(path)) Path.GetDirectoryName(Path.GetDirectoryName(path))
} }
}, RefreshPriority.High); }, RefreshPriority.High);
@ -1512,13 +1512,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{ {
BaseItem item = null; BaseItem item = null;
var parentPath = _fileSystem.GetDirectoryName(path); var parentPath = Path.GetDirectoryName(path);
while (item == null && !string.IsNullOrEmpty(path)) while (item == null && !string.IsNullOrEmpty(path))
{ {
item = _libraryManager.FindByPath(path, null); item = _libraryManager.FindByPath(path, null);
path = _fileSystem.GetDirectoryName(path); path = Path.GetDirectoryName(path);
} }
if (item != null) if (item != null)
@ -1676,7 +1676,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
while (FileExists(path, timerId)) while (FileExists(path, timerId))
{ {
var parent = _fileSystem.GetDirectoryName(originalPath); var parent = Path.GetDirectoryName(originalPath);
var name = Path.GetFileNameWithoutExtension(originalPath); var name = Path.GetFileNameWithoutExtension(originalPath);
name += " - " + index.ToString(CultureInfo.InvariantCulture); name += " - " + index.ToString(CultureInfo.InvariantCulture);
@ -1822,7 +1822,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
return; return;
} }
var imageSavePath = Path.Combine(_fileSystem.GetDirectoryName(recordingPath), imageSaveFilenameWithoutExtension); var imageSavePath = Path.Combine(Path.GetDirectoryName(recordingPath), imageSaveFilenameWithoutExtension);
// preserve original image extension // preserve original image extension
imageSavePath = Path.ChangeExtension(imageSavePath, Path.GetExtension(image.Path)); imageSavePath = Path.ChangeExtension(imageSavePath, Path.GetExtension(image.Path));

View File

@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private Task RecordFromFile(MediaSourceInfo mediaSource, string inputFile, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken) private Task RecordFromFile(MediaSourceInfo mediaSource, string inputFile, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken)
{ {
_targetPath = targetFile; _targetPath = targetFile;
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(targetFile)); _fileSystem.CreateDirectory(Path.GetDirectoryName(targetFile));
var process = _processFactory.Create(new ProcessOptions var process = _processFactory.Create(new ProcessOptions
{ {
@ -105,7 +105,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_logger.LogInformation(commandLineLogMessage); _logger.LogInformation(commandLineLogMessage);
var logFilePath = Path.Combine(_appPaths.LogDirectoryPath, "record-transcode-" + Guid.NewGuid() + ".txt"); var logFilePath = Path.Combine(_appPaths.LogDirectoryPath, "record-transcode-" + Guid.NewGuid() + ".txt");
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(logFilePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(logFilePath));
// FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory. // FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
_logFileStream = _fileSystem.GetFileStream(logFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true); _logFileStream = _fileSystem.GetFileStream(logFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true);

View File

@ -70,7 +70,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
} }
var file = _dataPath + ".json"; var file = _dataPath + ".json";
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(file)); _fileSystem.CreateDirectory(Path.GetDirectoryName(file));
lock (_fileDataLock) lock (_fileDataLock)
{ {

View File

@ -83,7 +83,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
}).ConfigureAwait(false); }).ConfigureAwait(false);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(cacheFile)); _fileSystem.CreateDirectory(Path.GetDirectoryName(cacheFile));
_fileSystem.CopyFile(tempFile, cacheFile, true); _fileSystem.CopyFile(tempFile, cacheFile, true);

View File

@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
{ {
try try
{ {
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(channelCacheFile)); FileSystem.CreateDirectory(Path.GetDirectoryName(channelCacheFile));
JsonSerializer.SerializeToFile(channels, channelCacheFile); JsonSerializer.SerializeToFile(channels, channelCacheFile);
} }
catch (IOException) catch (IOException)

View File

@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
var uri = new Uri(mediaSource.Path); var uri = new Uri(mediaSource.Path);
var localPort = _networkManager.GetRandomUnusedUdpPort(); var localPort = _networkManager.GetRandomUnusedUdpPort();
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(TempFilePath)); FileSystem.CreateDirectory(Path.GetDirectoryName(TempFilePath));
Logger.LogInformation("Opening HDHR UDP Live stream from {host}", uri.Host); Logger.LogInformation("Opening HDHR UDP Live stream from {host}", uri.Host);

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
@ -35,7 +36,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
var url = mediaSource.Path; var url = mediaSource.Path;
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(TempFilePath)); FileSystem.CreateDirectory(Path.GetDirectoryName(TempFilePath));
var typeName = GetType().Name; var typeName = GetType().Name;
Logger.LogInformation("Opening " + typeName + " Live stream from {0}", url); Logger.LogInformation("Opening " + typeName + " Live stream from {0}", url);

View File

@ -337,7 +337,7 @@ namespace Emby.Server.Implementations.Localization
.Where(i => i != null) .Where(i => i != null)
.ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase); .ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);
var countryCode = _fileSystem.GetFileNameWithoutExtension(file) var countryCode = Path.GetFileNameWithoutExtension(file)
.Split('-') .Split('-')
.Last(); .Last();

View File

@ -141,7 +141,7 @@ namespace Emby.Server.Implementations.MediaEncoder
var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, video.Path, protocol, null, Array.Empty<string>()); var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, video.Path, protocol, null, Array.Empty<string>());
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
var container = video.Container; var container = video.Container;

View File

@ -455,7 +455,7 @@ namespace Emby.Server.Implementations.Playlists
private string NormalizeItemPath(string playlistPath, string itemPath) private string NormalizeItemPath(string playlistPath, string itemPath)
{ {
return MakeRelativePath(_fileSystem.GetDirectoryName(playlistPath), itemPath); return MakeRelativePath(Path.GetDirectoryName(playlistPath), itemPath);
} }
private static string MakeRelativePath(string folderPath, string fileAbsolutePath) private static string MakeRelativePath(string folderPath, string fileAbsolutePath)

View File

@ -42,11 +42,11 @@ namespace Emby.Server.Implementations
private string GetResourcePath(string basePath, string virtualPath) private string GetResourcePath(string basePath, string virtualPath)
{ {
var fullPath = Path.Combine(basePath, virtualPath.Replace('/', _fileSystem.DirectorySeparatorChar)); var fullPath = Path.Combine(basePath, virtualPath.Replace('/', Path.DirectorySeparatorChar));
try try
{ {
fullPath = _fileSystem.GetFullPath(fullPath); fullPath = Path.GetFullPath(fullPath);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -139,7 +139,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{ {
previouslyFailedImages.Add(key); previouslyFailedImages.Add(key);
var parentPath = _fileSystem.GetDirectoryName(failHistoryPath); var parentPath = Path.GetDirectoryName(failHistoryPath);
_fileSystem.CreateDirectory(parentPath); _fileSystem.CreateDirectory(parentPath);

View File

@ -151,7 +151,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
_lastExecutionResult = value; _lastExecutionResult = value;
var path = GetHistoryFilePath(); var path = GetHistoryFilePath();
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
lock (_lastExecutionResultSyncLock) lock (_lastExecutionResultSyncLock)
{ {
@ -565,7 +565,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{ {
var path = GetConfigurationFilePath(); var path = GetConfigurationFilePath();
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
JsonSerializer.SerializeToFile(triggers, path); JsonSerializer.SerializeToFile(triggers, path);
} }

View File

@ -570,7 +570,7 @@ namespace Emby.Server.Implementations.Updates
// Success - move it to the real target // Success - move it to the real target
try try
{ {
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(target)); _fileSystem.CreateDirectory(Path.GetDirectoryName(target));
_fileSystem.CopyFile(tempFile, target, true); _fileSystem.CopyFile(tempFile, target, true);
//If it is an archive - write out a version file so we know what it is //If it is an archive - write out a version file so we know what it is
if (isArchive) if (isArchive)
@ -611,7 +611,7 @@ namespace Emby.Server.Implementations.Updates
_logger.LogInformation("Deleting plugin file {0}", path); _logger.LogInformation("Deleting plugin file {0}", path);
// Make this case-insensitive to account for possible incorrect assembly naming // Make this case-insensitive to account for possible incorrect assembly naming
var file = _fileSystem.GetFilePaths(_fileSystem.GetDirectoryName(path)) var file = _fileSystem.GetFilePaths(Path.GetDirectoryName(path))
.FirstOrDefault(i => string.Equals(i, path, StringComparison.OrdinalIgnoreCase)); .FirstOrDefault(i => string.Equals(i, path, StringComparison.OrdinalIgnoreCase));
if (!string.IsNullOrWhiteSpace(file)) if (!string.IsNullOrWhiteSpace(file))

View File

@ -219,7 +219,7 @@ namespace Jellyfin.Drawing.Skia
var tempPath = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid() + Path.GetExtension(path) ?? string.Empty); var tempPath = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid() + Path.GetExtension(path) ?? string.Empty);
fileSystem.CreateDirectory(fileSystem.GetDirectoryName(tempPath)); fileSystem.CreateDirectory(Path.GetDirectoryName(tempPath));
fileSystem.CopyFile(path, tempPath, true); fileSystem.CopyFile(path, tempPath, true);
return tempPath; return tempPath;
@ -532,7 +532,7 @@ namespace Jellyfin.Drawing.Skia
// If all we're doing is resizing then we can stop now // If all we're doing is resizing then we can stop now
if (!hasBackgroundColor && !hasForegroundColor && blur == 0 && !hasIndicator) if (!hasBackgroundColor && !hasForegroundColor && blur == 0 && !hasIndicator)
{ {
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(outputPath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(outputPath));
using (var outputStream = new SKFileWStream(outputPath)) using (var outputStream = new SKFileWStream(outputPath))
using (var pixmap = new SKPixmap(new SKImageInfo(width, height), resizedBitmap.GetPixels())) using (var pixmap = new SKPixmap(new SKImageInfo(width, height), resizedBitmap.GetPixels()))
{ {
@ -584,7 +584,7 @@ namespace Jellyfin.Drawing.Skia
DrawIndicator(canvas, width, height, options); DrawIndicator(canvas, width, height, options);
} }
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(outputPath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(outputPath));
using (var outputStream = new SKFileWStream(outputPath)) using (var outputStream = new SKFileWStream(outputPath))
{ {
using (var pixmap = new SKPixmap(new SKImageInfo(width, height), saveBitmap.GetPixels())) using (var pixmap = new SKPixmap(new SKImageInfo(width, height), saveBitmap.GetPixels()))

View File

@ -646,7 +646,7 @@ namespace MediaBrowser.Api
/// <param name="outputFilePath">The output file path.</param> /// <param name="outputFilePath">The output file path.</param>
private void DeleteHlsPartialStreamFiles(string outputFilePath) private void DeleteHlsPartialStreamFiles(string outputFilePath)
{ {
var directory = _fileSystem.GetDirectoryName(outputFilePath); var directory = Path.GetDirectoryName(outputFilePath);
var name = Path.GetFileNameWithoutExtension(outputFilePath); var name = Path.GetFileNameWithoutExtension(outputFilePath);
var filesToDelete = _fileSystem.GetFilePaths(directory) var filesToDelete = _fileSystem.GetFilePaths(directory)

View File

@ -303,7 +303,7 @@ namespace MediaBrowser.Api
public object Get(GetParentPath request) public object Get(GetParentPath request)
{ {
var parent = _fileSystem.GetDirectoryName(request.Path); var parent = Path.GetDirectoryName(request.Path);
if (string.IsNullOrEmpty(parent)) if (string.IsNullOrEmpty(parent))
{ {

View File

@ -158,7 +158,7 @@ namespace MediaBrowser.Api.Images
private string GetThemeName(string path, string rootImagePath) private string GetThemeName(string path, string rootImagePath)
{ {
var parentName = _fileSystem.GetDirectoryName(path); var parentName = Path.GetDirectoryName(path);
if (string.Equals(parentName, rootImagePath, StringComparison.OrdinalIgnoreCase)) if (string.Equals(parentName, rootImagePath, StringComparison.OrdinalIgnoreCase))
{ {

View File

@ -264,7 +264,7 @@ namespace MediaBrowser.Api.Images
var fullCachePath = GetFullCachePath(urlHash + "." + ext); var fullCachePath = GetFullCachePath(urlHash + "." + ext);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fullCachePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(fullCachePath));
using (var stream = result.Content) using (var stream = result.Content)
{ {
using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true)) using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
@ -273,7 +273,7 @@ namespace MediaBrowser.Api.Images
} }
} }
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(pointerCachePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(pointerCachePath));
_fileSystem.WriteAllText(pointerCachePath, fullCachePath); _fileSystem.WriteAllText(pointerCachePath, fullCachePath);
} }
} }

View File

@ -305,7 +305,7 @@ namespace MediaBrowser.Api
var fullCachePath = GetFullCachePath(urlHash + "." + ext); var fullCachePath = GetFullCachePath(urlHash + "." + ext);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fullCachePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(fullCachePath));
using (var stream = result.Content) using (var stream = result.Content)
{ {
using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true)) using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
@ -314,7 +314,7 @@ namespace MediaBrowser.Api
} }
} }
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(pointerCachePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(pointerCachePath));
_fileSystem.WriteAllText(pointerCachePath, fullCachePath); _fileSystem.WriteAllText(pointerCachePath, fullCachePath);
} }

View File

@ -192,7 +192,7 @@ namespace MediaBrowser.Api.Playback
CancellationTokenSource cancellationTokenSource, CancellationTokenSource cancellationTokenSource,
string workingDirectory = null) string workingDirectory = null)
{ {
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(outputPath)); FileSystem.CreateDirectory(Path.GetDirectoryName(outputPath));
await AcquireResources(state, cancellationTokenSource).ConfigureAwait(false); await AcquireResources(state, cancellationTokenSource).ConfigureAwait(false);
@ -258,7 +258,7 @@ namespace MediaBrowser.Api.Playback
} }
var logFilePath = Path.Combine(ServerConfigurationManager.ApplicationPaths.LogDirectoryPath, logFilePrefix + "-" + Guid.NewGuid() + ".txt"); var logFilePath = Path.Combine(ServerConfigurationManager.ApplicationPaths.LogDirectoryPath, logFilePrefix + "-" + Guid.NewGuid() + ".txt");
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(logFilePath)); FileSystem.CreateDirectory(Path.GetDirectoryName(logFilePath));
// FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory. // FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
state.LogFileStream = FileSystem.GetFileStream(logFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true); state.LogFileStream = FileSystem.GetFileStream(logFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true);

View File

@ -264,7 +264,7 @@ namespace MediaBrowser.Api.Playback.Hls
var useGenericSegmenter = true; var useGenericSegmenter = true;
if (useGenericSegmenter) if (useGenericSegmenter)
{ {
var outputTsArg = Path.Combine(FileSystem.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request); var outputTsArg = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request);
var timeDeltaParam = string.Empty; var timeDeltaParam = string.Empty;

View File

@ -381,7 +381,7 @@ namespace MediaBrowser.Api.Playback.Hls
private static FileSystemMetadata GetLastTranscodingFile(string playlist, string segmentExtension, IFileSystem fileSystem) private static FileSystemMetadata GetLastTranscodingFile(string playlist, string segmentExtension, IFileSystem fileSystem)
{ {
var folder = fileSystem.GetDirectoryName(playlist); var folder = Path.GetDirectoryName(playlist);
var filePrefix = Path.GetFileNameWithoutExtension(playlist) ?? string.Empty; var filePrefix = Path.GetFileNameWithoutExtension(playlist) ?? string.Empty;
@ -418,7 +418,7 @@ namespace MediaBrowser.Api.Playback.Hls
private string GetSegmentPath(StreamState state, string playlist, int index) private string GetSegmentPath(StreamState state, string playlist, int index)
{ {
var folder = FileSystem.GetDirectoryName(playlist); var folder = Path.GetDirectoryName(playlist);
var filename = Path.GetFileNameWithoutExtension(playlist); var filename = Path.GetFileNameWithoutExtension(playlist);
@ -932,7 +932,7 @@ namespace MediaBrowser.Api.Playback.Hls
var mapArgs = state.IsOutputVideo ? EncodingHelper.GetMapArgs(state) : string.Empty; var mapArgs = state.IsOutputVideo ? EncodingHelper.GetMapArgs(state) : string.Empty;
var outputTsArg = Path.Combine(FileSystem.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request); var outputTsArg = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request);
var timeDeltaParam = string.Empty; var timeDeltaParam = string.Empty;

View File

@ -228,7 +228,7 @@ namespace MediaBrowser.Controller.Entities
return Path; return Path;
} }
return FileSystem.GetDirectoryName(Path); return System.IO.Path.GetDirectoryName(Path);
} }
} }
@ -2208,7 +2208,7 @@ namespace MediaBrowser.Controller.Entities
{ {
var allFiles = ImageInfos var allFiles = ImageInfos
.Where(i => i.IsLocalFile) .Where(i => i.IsLocalFile)
.Select(i => FileSystem.GetDirectoryName(i.Path)) .Select(i => System.IO.Path.GetDirectoryName(i.Path))
.Distinct(StringComparer.OrdinalIgnoreCase) .Distinct(StringComparer.OrdinalIgnoreCase)
.SelectMany(i => directoryService.GetFilePaths(i)) .SelectMany(i => directoryService.GetFilePaths(i))
.ToList(); .ToList();
@ -2396,7 +2396,7 @@ namespace MediaBrowser.Controller.Entities
var extensions = new List<string> { ".nfo", ".xml", ".srt", ".vtt", ".sub", ".idx", ".txt", ".edl", ".bif", ".smi", ".ttml" }; var extensions = new List<string> { ".nfo", ".xml", ".srt", ".vtt", ".sub", ".idx", ".txt", ".edl", ".bif", ".smi", ".ttml" };
extensions.AddRange(SupportedImageExtensions); extensions.AddRange(SupportedImageExtensions);
return FileSystem.GetFiles(FileSystem.GetDirectoryName(Path), extensions.ToArray(), false, false) return FileSystem.GetFiles(System.IO.Path.GetDirectoryName(Path), extensions.ToArray(), false, false)
.Where(i => System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase)) .Where(i => System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase))
.ToList(); .ToList();
} }

View File

@ -87,7 +87,7 @@ namespace MediaBrowser.Controller.Entities
return new[] { return new[] {
new FileSystemMetadata new FileSystemMetadata
{ {
FullName = FileSystem.GetDirectoryName(Path), FullName = System.IO.Path.GetDirectoryName(Path),
IsDirectory = true IsDirectory = true
} }
}; };

View File

@ -97,7 +97,7 @@ namespace MediaBrowser.Controller.Entities.TV
return series.Path; return series.Path;
} }
return FileSystem.GetDirectoryName(Path); return System.IO.Path.GetDirectoryName(Path);
} }
} }

View File

@ -345,7 +345,7 @@ namespace MediaBrowser.Controller.Entities
{ {
if (IsStacked) if (IsStacked)
{ {
return FileSystem.GetDirectoryName(Path); return System.IO.Path.GetDirectoryName(Path);
} }
if (!IsPlaceHolder) if (!IsPlaceHolder)

View File

@ -85,7 +85,7 @@ namespace MediaBrowser.Controller.Library
return false; return false;
} }
var parentDir = BaseItem.FileSystem.GetDirectoryName(Path) ?? string.Empty; var parentDir = System.IO.Path.GetDirectoryName(Path) ?? string.Empty;
return parentDir.Length > _appPaths.RootFolderPath.Length return parentDir.Length > _appPaths.RootFolderPath.Length
&& parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase); && parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase);

View File

@ -50,7 +50,7 @@ namespace MediaBrowser.Controller.Playlists
if (IsPlaylistFile(path)) if (IsPlaylistFile(path))
{ {
return FileSystem.GetDirectoryName(path); return System.IO.Path.GetDirectoryName(path);
} }
return path; return path;

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Entities.TV;
@ -29,7 +30,7 @@ namespace MediaBrowser.LocalMetadata.Images
public List<LocalImageInfo> GetImages(BaseItem item, IDirectoryService directoryService) public List<LocalImageInfo> GetImages(BaseItem item, IDirectoryService directoryService)
{ {
var parentPath = _fileSystem.GetDirectoryName(item.Path); var parentPath = Path.GetDirectoryName(item.Path);
var parentPathFiles = directoryService.GetFiles(parentPath); var parentPathFiles = directoryService.GetFiles(parentPath);

View File

@ -33,7 +33,7 @@ namespace MediaBrowser.LocalMetadata.Providers
var specificFile = Path.ChangeExtension(info.Path, ".xml"); var specificFile = Path.ChangeExtension(info.Path, ".xml");
var file = FileSystem.GetFileInfo(specificFile); var file = FileSystem.GetFileInfo(specificFile);
return info.IsInMixedFolder || file.Exists ? file : FileSystem.GetFileInfo(Path.Combine(FileSystem.GetDirectoryName(info.Path), "game.xml")); return info.IsInMixedFolder || file.Exists ? file : FileSystem.GetFileInfo(Path.Combine(Path.GetDirectoryName(info.Path), "game.xml"));
} }
} }
} }

View File

@ -94,7 +94,7 @@ namespace MediaBrowser.LocalMetadata.Savers
private void SaveToFile(Stream stream, string path) private void SaveToFile(Stream stream, string path)
{ {
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(path)); FileSystem.CreateDirectory(Path.GetDirectoryName(path));
// On Windows, savint the file will fail if the file is hidden or readonly // On Windows, savint the file will fail if the file is hidden or readonly
FileSystem.SetAttributes(path, false, false); FileSystem.SetAttributes(path, false, false);

View File

@ -67,7 +67,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
.CreateJob(options, EncodingHelper, IsVideoEncoder, progress, cancellationToken).ConfigureAwait(false); .CreateJob(options, EncodingHelper, IsVideoEncoder, progress, cancellationToken).ConfigureAwait(false);
encodingJob.OutputFilePath = GetOutputFilePath(encodingJob); encodingJob.OutputFilePath = GetOutputFilePath(encodingJob);
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(encodingJob.OutputFilePath)); FileSystem.CreateDirectory(Path.GetDirectoryName(encodingJob.OutputFilePath));
encodingJob.ReadInputAtNativeFramerate = options.ReadInputAtNativeFramerate; encodingJob.ReadInputAtNativeFramerate = options.ReadInputAtNativeFramerate;
@ -105,7 +105,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
Logger.LogInformation(commandLineLogMessage); Logger.LogInformation(commandLineLogMessage);
var logFilePath = Path.Combine(ConfigurationManager.CommonApplicationPaths.LogDirectoryPath, "transcode-" + Guid.NewGuid() + ".txt"); var logFilePath = Path.Combine(ConfigurationManager.CommonApplicationPaths.LogDirectoryPath, "transcode-" + Guid.NewGuid() + ".txt");
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(logFilePath)); FileSystem.CreateDirectory(Path.GetDirectoryName(logFilePath));
// FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory. // FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
encodingJob.LogFileStream = FileSystem.GetFileStream(logFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true); encodingJob.LogFileStream = FileSystem.GetFileStream(logFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true);

View File

@ -353,7 +353,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
private string GetProbePathFromEncoderPath(string appPath) private string GetProbePathFromEncoderPath(string appPath)
{ {
return FileSystem.GetFilePaths(FileSystem.GetDirectoryName(appPath)) return FileSystem.GetFilePaths(Path.GetDirectoryName(appPath))
.FirstOrDefault(i => string.Equals(Path.GetFileNameWithoutExtension(i), "ffprobe", StringComparison.OrdinalIgnoreCase)); .FirstOrDefault(i => string.Equals(Path.GetFileNameWithoutExtension(i), "ffprobe", StringComparison.OrdinalIgnoreCase));
} }
@ -608,7 +608,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
} }
var tempExtractPath = Path.Combine(ConfigurationManager.ApplicationPaths.TempDirectory, Guid.NewGuid() + ".jpg"); var tempExtractPath = Path.Combine(ConfigurationManager.ApplicationPaths.TempDirectory, Guid.NewGuid() + ".jpg");
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(tempExtractPath)); FileSystem.CreateDirectory(Path.GetDirectoryName(tempExtractPath));
// apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600. // apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600.
// This filter chain may have adverse effects on recorded tv thumbnails if ar changes during presentation ex. commercials @ diff ar // This filter chain may have adverse effects on recorded tv thumbnails if ar changes during presentation ex. commercials @ diff ar

View File

@ -422,7 +422,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
throw new ArgumentNullException(nameof(outputPath)); throw new ArgumentNullException(nameof(outputPath));
} }
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(outputPath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(outputPath));
var encodingParam = await GetSubtitleFileCharacterSet(inputPath, language, inputProtocol, cancellationToken).ConfigureAwait(false); var encodingParam = await GetSubtitleFileCharacterSet(inputPath, language, inputProtocol, cancellationToken).ConfigureAwait(false);
@ -565,7 +565,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
throw new ArgumentNullException(nameof(outputPath)); throw new ArgumentNullException(nameof(outputPath));
} }
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(outputPath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(outputPath));
var processArgs = string.Format("-i {0} -map 0:{1} -an -vn -c:s {2} \"{3}\"", inputPath, var processArgs = string.Format("-i {0} -map 0:{1} -an -vn -c:s {2} \"{3}\"", inputPath,
subtitleStreamIndex, outputCodec, outputPath); subtitleStreamIndex, outputCodec, outputPath);

View File

@ -156,7 +156,7 @@ namespace MediaBrowser.Providers.BoxSets
var dataFilePath = GetDataFilePath(_config.ApplicationPaths, tmdbId, preferredMetadataLanguage); var dataFilePath = GetDataFilePath(_config.ApplicationPaths, tmdbId, preferredMetadataLanguage);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
_json.SerializeToFile(mainResult, dataFilePath); _json.SerializeToFile(mainResult, dataFilePath);
} }

View File

@ -233,14 +233,14 @@ namespace MediaBrowser.Providers.Manager
{ {
_logger.LogDebug("Saving image to {0}", path); _logger.LogDebug("Saving image to {0}", path);
var parentFolder = _fileSystem.GetDirectoryName(path); var parentFolder = Path.GetDirectoryName(path);
try try
{ {
_libraryMonitor.ReportFileSystemChangeBeginning(path); _libraryMonitor.ReportFileSystemChangeBeginning(path);
_libraryMonitor.ReportFileSystemChangeBeginning(parentFolder); _libraryMonitor.ReportFileSystemChangeBeginning(parentFolder);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
_fileSystem.SetAttributes(path, false, false); _fileSystem.SetAttributes(path, false, false);
@ -437,7 +437,7 @@ namespace MediaBrowser.Providers.Manager
{ {
if (type == ImageType.Primary && item is Episode) if (type == ImageType.Primary && item is Episode)
{ {
path = Path.Combine(_fileSystem.GetDirectoryName(item.Path), "metadata", filename + extension); path = Path.Combine(Path.GetDirectoryName(item.Path), "metadata", filename + extension);
} }
else if (item.IsInMixedFolder) else if (item.IsInMixedFolder)
@ -569,7 +569,7 @@ namespace MediaBrowser.Providers.Manager
if (item is Episode) if (item is Episode)
{ {
var seasonFolder = _fileSystem.GetDirectoryName(item.Path); var seasonFolder = Path.GetDirectoryName(item.Path);
var imageFilename = _fileSystem.GetFileNameWithoutExtension(item.Path) + "-thumb" + extension; var imageFilename = _fileSystem.GetFileNameWithoutExtension(item.Path) + "-thumb" + extension;
@ -617,7 +617,7 @@ namespace MediaBrowser.Providers.Manager
{ {
imageFilename = "poster"; imageFilename = "poster";
} }
var folder = _fileSystem.GetDirectoryName(item.Path); var folder = Path.GetDirectoryName(item.Path);
return Path.Combine(folder, _fileSystem.GetFileNameWithoutExtension(item.Path) + "-" + imageFilename + extension); return Path.Combine(folder, _fileSystem.GetFileNameWithoutExtension(item.Path) + "-" + imageFilename + extension);
} }

View File

@ -60,7 +60,7 @@ namespace MediaBrowser.Providers.MediaInfo
if (!_fileSystem.FileExists(path)) if (!_fileSystem.FileExists(path))
{ {
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
var imageStream = imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("front", StringComparison.OrdinalIgnoreCase) != -1) ?? var imageStream = imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("front", StringComparison.OrdinalIgnoreCase) != -1) ??
imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("cover", StringComparison.OrdinalIgnoreCase) != -1) ?? imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("cover", StringComparison.OrdinalIgnoreCase) != -1) ??

View File

@ -254,7 +254,7 @@ namespace MediaBrowser.Providers.Movies
var path = GetFanartJsonPath(id); var path = GetFanartJsonPath(id);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
try try
{ {

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Threading; using System.Threading;
@ -91,7 +92,7 @@ namespace MediaBrowser.Providers.Movies
tmdbId = movieInfo.id.ToString(_usCulture); tmdbId = movieInfo.id.ToString(_usCulture);
dataFilePath = MovieDbProvider.Current.GetDataFilePath(tmdbId, language); dataFilePath = MovieDbProvider.Current.GetDataFilePath(tmdbId, language);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
_jsonSerializer.SerializeToFile(movieInfo, dataFilePath); _jsonSerializer.SerializeToFile(movieInfo, dataFilePath);
} }
} }

View File

@ -198,7 +198,7 @@ namespace MediaBrowser.Providers.Movies
var dataFilePath = GetDataFilePath(id, preferredMetadataLanguage); var dataFilePath = GetDataFilePath(id, preferredMetadataLanguage);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
_jsonSerializer.SerializeToFile(mainResult, dataFilePath); _jsonSerializer.SerializeToFile(mainResult, dataFilePath);
} }

View File

@ -153,7 +153,7 @@ namespace MediaBrowser.Providers.Music
var path = GetAlbumInfoPath(_config.ApplicationPaths, musicBrainzReleaseGroupId); var path = GetAlbumInfoPath(_config.ApplicationPaths, musicBrainzReleaseGroupId);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
using (var httpResponse = await _httpClient.SendAsync(new HttpRequestOptions using (var httpResponse = await _httpClient.SendAsync(new HttpRequestOptions
{ {

View File

@ -151,7 +151,7 @@ namespace MediaBrowser.Providers.Music
{ {
using (var response = httpResponse.Content) using (var response = httpResponse.Content)
{ {
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
using (var xmlFileStream = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true)) using (var xmlFileStream = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
{ {

View File

@ -233,7 +233,7 @@ namespace MediaBrowser.Providers.Music
var jsonPath = GetArtistJsonPath(_config.ApplicationPaths, musicBrainzId); var jsonPath = GetArtistJsonPath(_config.ApplicationPaths, musicBrainzId);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(jsonPath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(jsonPath));
try try
{ {

View File

@ -294,7 +294,7 @@ namespace MediaBrowser.Providers.Omdb
using (var stream = response.Content) using (var stream = response.Content)
{ {
var rootObject = await _jsonSerializer.DeserializeFromStreamAsync<RootObject>(stream).ConfigureAwait(false); var rootObject = await _jsonSerializer.DeserializeFromStreamAsync<RootObject>(stream).ConfigureAwait(false);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
_jsonSerializer.SerializeToFile(rootObject, path); _jsonSerializer.SerializeToFile(rootObject, path);
} }
} }
@ -331,7 +331,7 @@ namespace MediaBrowser.Providers.Omdb
using (var stream = response.Content) using (var stream = response.Content)
{ {
var rootObject = await _jsonSerializer.DeserializeFromStreamAsync<SeasonRootObject>(stream).ConfigureAwait(false); var rootObject = await _jsonSerializer.DeserializeFromStreamAsync<SeasonRootObject>(stream).ConfigureAwait(false);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
_jsonSerializer.SerializeToFile(rootObject, path); _jsonSerializer.SerializeToFile(rootObject, path);
} }
} }

View File

@ -229,7 +229,7 @@ namespace MediaBrowser.Providers.People
{ {
using (var json = response.Content) using (var json = response.Content)
{ {
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
using (var fs = _fileSystem.GetFileStream(dataFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true)) using (var fs = _fileSystem.GetFileStream(dataFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
{ {

View File

@ -151,7 +151,7 @@ namespace MediaBrowser.Providers.Studios
}).ConfigureAwait(false); }).ConfigureAwait(false);
fileSystem.CreateDirectory(fileSystem.GetDirectoryName(file)); fileSystem.CreateDirectory(Path.GetDirectoryName(file));
try try
{ {

View File

@ -217,7 +217,7 @@ namespace MediaBrowser.Providers.Subtitles
try try
{ {
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(savePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(savePath));
using (var fs = _fileSystem.GetFileStream(savePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true)) using (var fs = _fileSystem.GetFileStream(savePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
{ {

View File

@ -298,7 +298,7 @@ namespace MediaBrowser.Providers.TV
var path = GetFanartJsonPath(tvdbId); var path = GetFanartJsonPath(tvdbId);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
try try
{ {

View File

@ -101,7 +101,7 @@ namespace MediaBrowser.Providers.TV
var dataFilePath = GetDataFilePath(id, seasonNumber, episodeNumber, preferredMetadataLanguage); var dataFilePath = GetDataFilePath(id, seasonNumber, episodeNumber, preferredMetadataLanguage);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
_jsonSerializer.SerializeToFile(mainResult, dataFilePath); _jsonSerializer.SerializeToFile(mainResult, dataFilePath);
} }

View File

@ -188,7 +188,7 @@ namespace MediaBrowser.Providers.TV
var dataFilePath = GetDataFilePath(id, seasonNumber, preferredMetadataLanguage); var dataFilePath = GetDataFilePath(id, seasonNumber, preferredMetadataLanguage);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
_jsonSerializer.SerializeToFile(mainResult, dataFilePath); _jsonSerializer.SerializeToFile(mainResult, dataFilePath);
} }

View File

@ -187,7 +187,7 @@ namespace MediaBrowser.Providers.TV
tmdbId = seriesInfo.id.ToString(_usCulture); tmdbId = seriesInfo.id.ToString(_usCulture);
string dataFilePath = GetDataFilePath(tmdbId, language); string dataFilePath = GetDataFilePath(tmdbId, language);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
_jsonSerializer.SerializeToFile(seriesInfo, dataFilePath); _jsonSerializer.SerializeToFile(seriesInfo, dataFilePath);
await EnsureSeriesInfo(tmdbId, language, cancellationToken).ConfigureAwait(false); await EnsureSeriesInfo(tmdbId, language, cancellationToken).ConfigureAwait(false);
@ -351,7 +351,7 @@ namespace MediaBrowser.Providers.TV
var dataFilePath = GetDataFilePath(id, preferredMetadataLanguage); var dataFilePath = GetDataFilePath(id, preferredMetadataLanguage);
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath)); _fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
_jsonSerializer.SerializeToFile(mainResult, dataFilePath); _jsonSerializer.SerializeToFile(mainResult, dataFilePath);
} }

View File

@ -197,7 +197,7 @@ namespace MediaBrowser.Providers.TV
if (searchInfo.IndexNumber.HasValue) if (searchInfo.IndexNumber.HasValue)
{ {
var files = GetEpisodeXmlFiles(searchInfo.SeriesDisplayOrder, searchInfo.ParentIndexNumber, searchInfo.IndexNumber, searchInfo.IndexNumberEnd, _fileSystem.GetDirectoryName(xmlFile)); var files = GetEpisodeXmlFiles(searchInfo.SeriesDisplayOrder, searchInfo.ParentIndexNumber, searchInfo.IndexNumber, searchInfo.IndexNumberEnd, Path.GetDirectoryName(xmlFile));
list = files.Select(GetXmlReader).ToList(); list = files.Select(GetXmlReader).ToList();
} }

View File

@ -193,7 +193,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
private void SaveToFile(Stream stream, string path) private void SaveToFile(Stream stream, string path)
{ {
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(path)); FileSystem.CreateDirectory(Path.GetDirectoryName(path));
// On Windows, savint the file will fail if the file is hidden or readonly // On Windows, savint the file will fail if the file is hidden or readonly
FileSystem.SetAttributes(path, false, false); FileSystem.SetAttributes(path, false, false);