diff options
| author | Bond_009 <bond.009@outlook.com> | 2021-10-03 19:52:38 +0200 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2021-10-03 19:52:38 +0200 |
| commit | 9af16fcb6c892238b734c267873b1fc137d38e66 (patch) | |
| tree | d6a954b0e41c988f55d1500e944c1fe5f2decf04 /Emby.Dlna | |
| parent | 9718c0b2eeb3ff2c2d0f613bfb51db6a025b0a07 (diff) | |
Remove workaround for dotnet/runtime#42790
Diffstat (limited to 'Emby.Dlna')
| -rw-r--r-- | Emby.Dlna/DlnaManager.cs | 9 |
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); } |
