aboutsummaryrefslogtreecommitdiff
path: root/Emby.Dlna
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2021-10-03 19:52:38 +0200
committerBond_009 <bond.009@outlook.com>2021-10-03 19:52:38 +0200
commit9af16fcb6c892238b734c267873b1fc137d38e66 (patch)
treed6a954b0e41c988f55d1500e944c1fe5f2decf04 /Emby.Dlna
parent9718c0b2eeb3ff2c2d0f613bfb51db6a025b0a07 (diff)
Remove workaround for dotnet/runtime#42790
Diffstat (limited to 'Emby.Dlna')
-rw-r--r--Emby.Dlna/DlnaManager.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs
index 8fe9d484e..73e8a0008 100644
--- a/Emby.Dlna/DlnaManager.cs
+++ b/Emby.Dlna/DlnaManager.cs
@@ -359,14 +359,17 @@ namespace Emby.Dlna
// The stream should exist as we just got its name from GetManifestResourceNames
using (var stream = _assembly.GetManifestResourceStream(name)!)
{
+ var length = stream.Length;
var fileInfo = _fileSystem.GetFileInfo(path);
- if (!fileInfo.Exists || fileInfo.Length != stream.Length)
+ if (!fileInfo.Exists || fileInfo.Length != length)
{
Directory.CreateDirectory(systemProfilesPath);
- // use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
- using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, FileOptions.Asynchronous))
+ var fileOptions = AsyncFile.WriteOptions;
+ fileOptions.Mode = FileMode.CreateNew;
+ fileOptions.PreallocationSize = length;
+ using (var fileStream = new FileStream(path, fileOptions))
{
await stream.CopyToAsync(fileStream).ConfigureAwait(false);
}