Merge pull request #5007 from jellyfin/create

pull/5033/head
Joshua M. Boniface 4 years ago committed by GitHub
commit 03242a6afd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -177,7 +177,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
lock (_lastExecutionResultSyncLock)
{
using FileStream createStream = File.OpenWrite(path);
using FileStream createStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None);
JsonSerializer.SerializeAsync(createStream, value, _jsonOptions);
}
}
@ -577,9 +577,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
var path = GetConfigurationFilePath();
Directory.CreateDirectory(Path.GetDirectoryName(path));
var json = JsonSerializer.Serialize(triggers, _jsonOptions);
File.WriteAllText(path, json, Encoding.UTF8);
using FileStream createStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None);
JsonSerializer.SerializeAsync(createStream, triggers, _jsonOptions);
}
/// <summary>

@ -272,6 +272,10 @@ namespace MediaBrowser.Providers.Plugins.Omdb
return path;
}
}
else
{
Directory.CreateDirectory(Path.GetDirectoryName(path));
}
var url = GetOmdbUrl(
string.Format(
@ -280,8 +284,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
imdbParam));
var rootObject = await GetDeserializedOmdbResponse<RootObject>(_httpClientFactory.CreateClient(NamedClient.Default), url, cancellationToken).ConfigureAwait(false);
Directory.CreateDirectory(Path.GetDirectoryName(path));
await using FileStream jsonFileStream = File.OpenWrite(path);
await using FileStream jsonFileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None);
await JsonSerializer.SerializeAsync(jsonFileStream, rootObject, _jsonOptions, cancellationToken).ConfigureAwait(false);
return path;
@ -308,6 +311,10 @@ namespace MediaBrowser.Providers.Plugins.Omdb
return path;
}
}
else
{
Directory.CreateDirectory(Path.GetDirectoryName(path));
}
var url = GetOmdbUrl(
string.Format(
@ -317,8 +324,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
seasonId));
var rootObject = await GetDeserializedOmdbResponse<SeasonRootObject>(_httpClientFactory.CreateClient(NamedClient.Default), url, cancellationToken).ConfigureAwait(false);
Directory.CreateDirectory(Path.GetDirectoryName(path));
await using FileStream jsonFileStream = File.OpenWrite(path);
await using FileStream jsonFileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None);
await JsonSerializer.SerializeAsync(jsonFileStream, rootObject, _jsonOptions, cancellationToken).ConfigureAwait(false);
return path;

Loading…
Cancel
Save