Merge pull request #5106 from BaronGreenback/FileShareTest2

(cherry picked from commit 28ffbf6945)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
Bond-009 2021-02-03 19:16:22 +01:00 committed by Joshua M. Boniface
parent a934477850
commit d816995d27

View file

@ -202,10 +202,11 @@ namespace MediaBrowser.XbmcMetadata.Savers
{
Directory.CreateDirectory(Path.GetDirectoryName(path));
// On Windows, savint the file will fail if the file is hidden or readonly
// On Windows, saving the file will fail if the file is hidden or readonly
FileSystem.SetAttributes(path, false, false);
using (var filestream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
using (var filestream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None))
{
stream.CopyTo(filestream);
}