Unwrapped CreateDirectory and DeleteDirectory

This commit is contained in:
Erwin de Haan 2019-01-26 22:08:04 +01:00
parent 3a831994f6
commit d7c6d16250
58 changed files with 102 additions and 101 deletions

View File

@ -379,7 +379,7 @@ namespace Emby.Dlna
if (!fileInfo.Exists || fileInfo.Length != stream.Length) if (!fileInfo.Exists || fileInfo.Length != stream.Length)
{ {
_fileSystem.CreateDirectory(systemProfilesPath); Directory.CreateDirectory(systemProfilesPath);
using (var fileStream = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) using (var fileStream = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
{ {
@ -390,7 +390,7 @@ namespace Emby.Dlna
} }
// Not necessary, but just to make it easy to find // Not necessary, but just to make it easy to find
_fileSystem.CreateDirectory(UserProfilesPath); Directory.CreateDirectory(UserProfilesPath);
} }
public void DeleteProfile(string id) public void DeleteProfile(string id)

View File

@ -631,7 +631,7 @@ namespace Emby.Drawing
return (enhancedImagePath, treatmentRequiresTransparency); return (enhancedImagePath, treatmentRequiresTransparency);
} }
_fileSystem.CreateDirectory(Path.GetDirectoryName(enhancedImagePath)); Directory.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

@ -327,7 +327,7 @@ namespace IsoMounter
try try
{ {
FileSystem.CreateDirectory(mountPoint); Directory.CreateDirectory(mountPoint);
} }
catch (UnauthorizedAccessException) catch (UnauthorizedAccessException)
{ {
@ -377,7 +377,7 @@ namespace IsoMounter
try try
{ {
FileSystem.DeleteDirectory(mountPoint, false); Directory.Delete(mountPoint, false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -455,7 +455,7 @@ namespace IsoMounter
try try
{ {
FileSystem.DeleteDirectory(mount.MountedPath, false); Directory.Delete(mount.MountedPath, false);
} }
catch (Exception ex) catch (Exception ex)
{ {

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(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(path)); Directory.CreateDirectory(Path.GetDirectoryName(path));
_jsonSerializer.SerializeToFile(result, path); _jsonSerializer.SerializeToFile(result, path);
} }

View File

@ -76,7 +76,7 @@ namespace Emby.Server.Implementations.Collections
return null; return null;
} }
_fileSystem.CreateDirectory(path); Directory.CreateDirectory(path);
var libraryOptions = new LibraryOptions var libraryOptions = new LibraryOptions
{ {
@ -133,7 +133,7 @@ namespace Emby.Server.Implementations.Collections
try try
{ {
_fileSystem.CreateDirectory(path); Directory.CreateDirectory(path);
var collection = new BoxSet var collection = new BoxSet
{ {

View File

@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Devices
{ {
var path = CachePath; var path = CachePath;
_fileSystem.CreateDirectory(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(path)); Directory.CreateDirectory(Path.GetDirectoryName(path));
lock (_cameraUploadSyncLock) lock (_cameraUploadSyncLock)
{ {
@ -317,7 +317,7 @@ namespace Emby.Server.Implementations.Devices
return Task.CompletedTask; return Task.CompletedTask;
} }
_fileSystem.CreateDirectory(path); Directory.CreateDirectory(path);
var libraryOptions = new LibraryOptions var libraryOptions = new LibraryOptions
{ {

View File

@ -75,7 +75,7 @@ namespace Emby.Server.Implementations.FFMpeg
Version = version Version = version
}; };
_fileSystem.CreateDirectory(versionedDirectoryPath); Directory.CreateDirectory(versionedDirectoryPath);
var excludeFromDeletions = new List<string> { versionedDirectoryPath }; var excludeFromDeletions = new List<string> { versionedDirectoryPath };

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(Path.GetDirectoryName(responseCachePath)); Directory.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))
{ {
@ -513,7 +513,7 @@ namespace Emby.Server.Implementations.HttpClientManager
{ {
ValidateParams(options); ValidateParams(options);
_fileSystem.CreateDirectory(_appPaths.TempDirectory); Directory.CreateDirectory(_appPaths.TempDirectory);
var tempFile = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid() + ".tmp"); var tempFile = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid() + ".tmp");

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(Path.GetDirectoryName(outputPathWithoutExtension)); Directory.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(Path.GetDirectoryName(outputPath)); Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
var options = new ImageCollageOptions var options = new ImageCollageOptions
{ {

View File

@ -375,7 +375,7 @@ namespace Emby.Server.Implementations.Library
try try
{ {
_fileSystem.DeleteDirectory(metadataPath, true); Directory.Delete(metadataPath, true);
} }
catch (IOException) catch (IOException)
{ {
@ -402,11 +402,11 @@ namespace Emby.Server.Implementations.Library
_logger.LogDebug("Deleting path {path}", fileSystemInfo.FullName); _logger.LogDebug("Deleting path {path}", fileSystemInfo.FullName);
if (fileSystemInfo.IsDirectory) if (fileSystemInfo.IsDirectory)
{ {
_fileSystem.DeleteDirectory(fileSystemInfo.FullName, true); Directory.Delete(fileSystemInfo.FullName, true);
} }
else else
{ {
_fileSystem.DeleteFile(fileSystemInfo.FullName); File.Delete(fileSystemInfo.FullName);
} }
} }
catch (IOException) catch (IOException)
@ -720,7 +720,7 @@ namespace Emby.Server.Implementations.Library
{ {
var rootFolderPath = ConfigurationManager.ApplicationPaths.RootFolderPath; var rootFolderPath = ConfigurationManager.ApplicationPaths.RootFolderPath;
_fileSystem.CreateDirectory(rootFolderPath); Directory.CreateDirectory(rootFolderPath);
var rootFolder = GetItemById(GetNewItemId(rootFolderPath, typeof(AggregateFolder))) as AggregateFolder ?? ((Folder)ResolvePath(_fileSystem.GetDirectoryInfo(rootFolderPath))).DeepCopy<Folder, AggregateFolder>(); var rootFolder = GetItemById(GetNewItemId(rootFolderPath, typeof(AggregateFolder))) as AggregateFolder ?? ((Folder)ResolvePath(_fileSystem.GetDirectoryInfo(rootFolderPath))).DeepCopy<Folder, AggregateFolder>();
@ -734,7 +734,7 @@ namespace Emby.Server.Implementations.Library
// Add in the plug-in folders // Add in the plug-in folders
var path = Path.Combine(ConfigurationManager.ApplicationPaths.DataPath, "playlists"); var path = Path.Combine(ConfigurationManager.ApplicationPaths.DataPath, "playlists");
_fileSystem.CreateDirectory(path); Directory.CreateDirectory(path);
Folder folder = new PlaylistsFolder Folder folder = new PlaylistsFolder
{ {
@ -785,7 +785,7 @@ namespace Emby.Server.Implementations.Library
{ {
var userRootPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath; var userRootPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
_fileSystem.CreateDirectory(userRootPath); Directory.CreateDirectory(userRootPath);
var tmpItem = GetItemById(GetNewItemId(userRootPath, typeof(UserRootFolder))) as UserRootFolder; var tmpItem = GetItemById(GetNewItemId(userRootPath, typeof(UserRootFolder))) as UserRootFolder;
@ -999,7 +999,7 @@ namespace Emby.Server.Implementations.Library
public Task ValidatePeople(CancellationToken cancellationToken, IProgress<double> progress) public Task ValidatePeople(CancellationToken cancellationToken, IProgress<double> progress)
{ {
// Ensure the location is available. // Ensure the location is available.
_fileSystem.CreateDirectory(ConfigurationManager.ApplicationPaths.PeoplePath); Directory.CreateDirectory(ConfigurationManager.ApplicationPaths.PeoplePath);
return new PeopleValidator(this, _logger, ConfigurationManager, _fileSystem).ValidatePeople(cancellationToken, progress); return new PeopleValidator(this, _logger, ConfigurationManager, _fileSystem).ValidatePeople(cancellationToken, progress);
} }
@ -2146,7 +2146,7 @@ namespace Emby.Server.Implementations.Library
if (item == null || !string.Equals(item.Path, path, StringComparison.OrdinalIgnoreCase)) if (item == null || !string.Equals(item.Path, path, StringComparison.OrdinalIgnoreCase))
{ {
_fileSystem.CreateDirectory(path); Directory.CreateDirectory(path);
item = new UserView item = new UserView
{ {
@ -2191,7 +2191,7 @@ namespace Emby.Server.Implementations.Library
if (item == null) if (item == null)
{ {
_fileSystem.CreateDirectory(path); Directory.CreateDirectory(path);
item = new UserView item = new UserView
{ {
@ -2256,7 +2256,7 @@ namespace Emby.Server.Implementations.Library
if (item == null) if (item == null)
{ {
_fileSystem.CreateDirectory(path); Directory.CreateDirectory(path);
item = new UserView item = new UserView
{ {
@ -2324,7 +2324,7 @@ namespace Emby.Server.Implementations.Library
if (item == null) if (item == null)
{ {
_fileSystem.CreateDirectory(path); Directory.CreateDirectory(path);
item = new UserView item = new UserView
{ {
@ -2883,7 +2883,7 @@ namespace Emby.Server.Implementations.Library
try try
{ {
_fileSystem.CreateDirectory(virtualFolderPath); Directory.CreateDirectory(virtualFolderPath);
if (!string.IsNullOrEmpty(collectionType)) if (!string.IsNullOrEmpty(collectionType))
{ {
@ -3082,7 +3082,7 @@ namespace Emby.Server.Implementations.Library
try try
{ {
_fileSystem.DeleteDirectory(path, true); Directory.Delete(path, true);
} }
finally finally
{ {

View File

@ -670,7 +670,7 @@ namespace Emby.Server.Implementations.Library
if (cacheFilePath != null) if (cacheFilePath != null)
{ {
_fileSystem.CreateDirectory(Path.GetDirectoryName(cacheFilePath)); Directory.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

@ -1080,7 +1080,7 @@ namespace Emby.Server.Implementations.Library
var path = GetPolicyFilePath(user); var path = GetPolicyFilePath(user);
_fileSystem.CreateDirectory(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(path)); Directory.CreateDirectory(Path.GetDirectoryName(path));
lock (_configSyncLock) lock (_configSyncLock)
{ {

View File

@ -42,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(Path.GetDirectoryName(targetFile)); Directory.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))
{ {
@ -78,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(Path.GetDirectoryName(targetFile)); Directory.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

@ -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(Path.GetDirectoryName(targetFile)); Directory.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(Path.GetDirectoryName(logFilePath)); Directory.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(Path.GetDirectoryName(file)); Directory.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(Path.GetDirectoryName(cacheFile)); Directory.CreateDirectory(Path.GetDirectoryName(cacheFile));
_fileSystem.CopyFile(tempFile, cacheFile, true); _fileSystem.CopyFile(tempFile, cacheFile, true);
@ -125,7 +125,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
using (var stream = _fileSystem.OpenRead(file)) using (var stream = _fileSystem.OpenRead(file))
{ {
string tempFolder = Path.Combine(_config.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString()); string tempFolder = Path.Combine(_config.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString());
_fileSystem.CreateDirectory(tempFolder); Directory.CreateDirectory(tempFolder);
_zipClient.ExtractFirstFileFromGz(stream, tempFolder, "data.xml"); _zipClient.ExtractFirstFileFromGz(stream, tempFolder, "data.xml");
@ -138,7 +138,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
using (var stream = _fileSystem.OpenRead(file)) using (var stream = _fileSystem.OpenRead(file))
{ {
string tempFolder = Path.Combine(_config.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString()); string tempFolder = Path.Combine(_config.ApplicationPaths.TempDirectory, Guid.NewGuid().ToString());
_fileSystem.CreateDirectory(tempFolder); Directory.CreateDirectory(tempFolder);
_zipClient.ExtractAllFromGz(stream, tempFolder, true); _zipClient.ExtractAllFromGz(stream, tempFolder, true);

View File

@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
{ {
try try
{ {
FileSystem.CreateDirectory(Path.GetDirectoryName(channelCacheFile)); Directory.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(Path.GetDirectoryName(TempFilePath)); Directory.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

@ -36,7 +36,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
var url = mediaSource.Path; var url = mediaSource.Path;
FileSystem.CreateDirectory(Path.GetDirectoryName(TempFilePath)); Directory.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

@ -70,7 +70,7 @@ namespace Emby.Server.Implementations.Localization
var localizationPath = LocalizationPath; var localizationPath = LocalizationPath;
_fileSystem.CreateDirectory(localizationPath); Directory.CreateDirectory(localizationPath);
var existingFiles = GetRatingsFiles(localizationPath) var existingFiles = GetRatingsFiles(localizationPath)
.Select(Path.GetFileName) .Select(Path.GetFileName)

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(Path.GetDirectoryName(path)); Directory.CreateDirectory(Path.GetDirectoryName(path));
var container = video.Container; var container = video.Container;

View File

@ -119,7 +119,7 @@ namespace Emby.Server.Implementations.Playlists
try try
{ {
_fileSystem.CreateDirectory(path); Directory.CreateDirectory(path);
var playlist = new Playlist var playlist = new Playlist
{ {

View File

@ -141,7 +141,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
var parentPath = Path.GetDirectoryName(failHistoryPath); var parentPath = Path.GetDirectoryName(failHistoryPath);
_fileSystem.CreateDirectory(parentPath); Directory.CreateDirectory(parentPath);
_fileSystem.WriteAllText(failHistoryPath, string.Join("|", previouslyFailedImages.ToArray())); _fileSystem.WriteAllText(failHistoryPath, string.Join("|", previouslyFailedImages.ToArray()));
} }

View File

@ -151,7 +151,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
_lastExecutionResult = value; _lastExecutionResult = value;
var path = GetHistoryFilePath(); var path = GetHistoryFilePath();
_fileSystem.CreateDirectory(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(path)); Directory.CreateDirectory(Path.GetDirectoryName(path));
JsonSerializer.SerializeToFile(triggers, path); JsonSerializer.SerializeToFile(triggers, path);
} }

View File

@ -128,7 +128,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
{ {
try try
{ {
_fileSystem.DeleteDirectory(directory, false); Directory.Delete(directory, false);
} }
catch (UnauthorizedAccessException ex) catch (UnauthorizedAccessException ex)
{ {

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(Path.GetDirectoryName(target)); Directory.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)

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(Path.GetDirectoryName(tempPath)); Directory.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(Path.GetDirectoryName(outputPath)); Directory.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(Path.GetDirectoryName(outputPath)); Directory.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

@ -264,7 +264,7 @@ namespace MediaBrowser.Api.Images
var fullCachePath = GetFullCachePath(urlHash + "." + ext); var fullCachePath = GetFullCachePath(urlHash + "." + ext);
_fileSystem.CreateDirectory(Path.GetDirectoryName(fullCachePath)); Directory.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(Path.GetDirectoryName(pointerCachePath)); Directory.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(Path.GetDirectoryName(fullCachePath)); Directory.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(Path.GetDirectoryName(pointerCachePath)); Directory.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(Path.GetDirectoryName(outputPath)); Directory.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(Path.GetDirectoryName(logFilePath)); Directory.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

@ -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.Controller.Library; using MediaBrowser.Controller.Library;
@ -169,7 +170,7 @@ namespace MediaBrowser.Controller.Entities
// Exceptions will be thrown if these paths already exist // Exceptions will be thrown if these paths already exist
if (FileSystem.DirectoryExists(newConfigDirectory)) if (FileSystem.DirectoryExists(newConfigDirectory))
{ {
FileSystem.DeleteDirectory(newConfigDirectory, true); Directory.Delete(newConfigDirectory, true);
} }
if (FileSystem.DirectoryExists(oldConfigurationDirectory)) if (FileSystem.DirectoryExists(oldConfigurationDirectory))
@ -178,7 +179,7 @@ namespace MediaBrowser.Controller.Entities
} }
else else
{ {
FileSystem.CreateDirectory(newConfigDirectory); Directory.CreateDirectory(newConfigDirectory);
} }
} }

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(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(encodingJob.OutputFilePath)); Directory.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(Path.GetDirectoryName(logFilePath)); Directory.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

@ -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(Path.GetDirectoryName(tempExtractPath)); Directory.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
@ -770,7 +770,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
vf += string.Format(",scale=min(iw\\,{0}):trunc(ow/dar/2)*2", maxWidthParam); vf += string.Format(",scale=min(iw\\,{0}):trunc(ow/dar/2)*2", maxWidthParam);
} }
FileSystem.CreateDirectory(targetDirectory); Directory.CreateDirectory(targetDirectory);
var outputPath = Path.Combine(targetDirectory, filenamePrefix + "%05d.jpg"); var outputPath = Path.Combine(targetDirectory, filenamePrefix + "%05d.jpg");
var args = string.Format("-i {0} -threads 0 -v quiet -vf \"{2}\" -f image2 \"{1}\"", inputArgument, outputPath, vf); var args = string.Format("-i {0} -threads 0 -v quiet -vf \"{2}\" -f image2 \"{1}\"", inputArgument, outputPath, vf);

View File

@ -422,7 +422,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
throw new ArgumentNullException(nameof(outputPath)); throw new ArgumentNullException(nameof(outputPath));
} }
_fileSystem.CreateDirectory(Path.GetDirectoryName(outputPath)); Directory.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(Path.GetDirectoryName(outputPath)); Directory.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(Path.GetDirectoryName(dataFilePath)); Directory.CreateDirectory(Path.GetDirectoryName(dataFilePath));
_json.SerializeToFile(mainResult, dataFilePath); _json.SerializeToFile(mainResult, dataFilePath);
} }

View File

@ -240,7 +240,7 @@ namespace MediaBrowser.Providers.Manager
_libraryMonitor.ReportFileSystemChangeBeginning(path); _libraryMonitor.ReportFileSystemChangeBeginning(path);
_libraryMonitor.ReportFileSystemChangeBeginning(parentFolder); _libraryMonitor.ReportFileSystemChangeBeginning(parentFolder);
_fileSystem.CreateDirectory(Path.GetDirectoryName(path)); Directory.CreateDirectory(Path.GetDirectoryName(path));
_fileSystem.SetAttributes(path, false, false); _fileSystem.SetAttributes(path, false, false);

View File

@ -60,7 +60,7 @@ namespace MediaBrowser.Providers.MediaInfo
if (!_fileSystem.FileExists(path)) if (!_fileSystem.FileExists(path))
{ {
_fileSystem.CreateDirectory(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(path)); Directory.CreateDirectory(Path.GetDirectoryName(path));
try try
{ {

View File

@ -92,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(Path.GetDirectoryName(dataFilePath)); Directory.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(Path.GetDirectoryName(dataFilePath)); Directory.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(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(jsonPath)); Directory.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(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(dataFilePath)); Directory.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(Path.GetDirectoryName(file)); Directory.CreateDirectory(Path.GetDirectoryName(file));
try try
{ {

View File

@ -217,7 +217,7 @@ namespace MediaBrowser.Providers.Subtitles
try try
{ {
_fileSystem.CreateDirectory(Path.GetDirectoryName(savePath)); Directory.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(Path.GetDirectoryName(path)); Directory.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(Path.GetDirectoryName(dataFilePath)); Directory.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(Path.GetDirectoryName(dataFilePath)); Directory.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(Path.GetDirectoryName(dataFilePath)); Directory.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(Path.GetDirectoryName(dataFilePath)); Directory.CreateDirectory(Path.GetDirectoryName(dataFilePath));
_jsonSerializer.SerializeToFile(mainResult, dataFilePath); _jsonSerializer.SerializeToFile(mainResult, dataFilePath);
} }

View File

@ -82,7 +82,7 @@ namespace MediaBrowser.Providers.TV
{ {
var path = TvdbSeriesProvider.GetSeriesDataPath(_config.CommonApplicationPaths); var path = TvdbSeriesProvider.GetSeriesDataPath(_config.CommonApplicationPaths);
_fileSystem.CreateDirectory(path); Directory.CreateDirectory(path);
var timestampFile = Path.Combine(path, "time.txt"); var timestampFile = Path.Combine(path, "time.txt");
@ -390,7 +390,7 @@ namespace MediaBrowser.Providers.TV
seriesDataPath = Path.Combine(seriesDataPath, id); seriesDataPath = Path.Combine(seriesDataPath, id);
_fileSystem.CreateDirectory(seriesDataPath); Directory.CreateDirectory(seriesDataPath);
return TvdbSeriesProvider.Current.DownloadSeriesZip(id, MetadataProviders.Tvdb.ToString(), null, null, seriesDataPath, lastTvDbUpdateTime, preferredMetadataLanguage, cancellationToken); return TvdbSeriesProvider.Current.DownloadSeriesZip(id, MetadataProviders.Tvdb.ToString(), null, null, seriesDataPath, lastTvDbUpdateTime, preferredMetadataLanguage, cancellationToken);
} }

View File

@ -390,7 +390,7 @@ namespace MediaBrowser.WebDashboard.Api
{ {
try try
{ {
_fileSystem.DeleteDirectory(targetPath, true); Directory.Delete(targetPath, true);
} }
catch (IOException) catch (IOException)
{ {
@ -435,11 +435,11 @@ namespace MediaBrowser.WebDashboard.Api
private void CopyDirectory(string source, string destination) private void CopyDirectory(string source, string destination)
{ {
_fileSystem.CreateDirectory(destination); Directory.CreateDirectory(destination);
//Now Create all of the directories //Now Create all of the directories
foreach (var dirPath in _fileSystem.GetDirectories(source, true)) foreach (var dirPath in _fileSystem.GetDirectories(source, true))
_fileSystem.CreateDirectory(dirPath.FullName.Replace(source, destination)); Directory.CreateDirectory(dirPath.FullName.Replace(source, destination));
//Copy all the files & Replaces any files with the same name //Copy all the files & Replaces any files with the same name
foreach (var newPath in _fileSystem.GetFiles(source, true)) foreach (var newPath in _fileSystem.GetFiles(source, true))

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(Path.GetDirectoryName(path)); Directory.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);