From 0abd9fd2547200e407250bf3bee363256a8304b1 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Tue, 19 Sep 2023 22:02:35 +0200 Subject: [PATCH] Generate a more random temporary file name. --- src/Magick.NET/Helpers/TemporaryFile.cs | 2 +- tests/Magick.NET.Tests/TestHelpers/TemporaryFile.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Magick.NET/Helpers/TemporaryFile.cs b/src/Magick.NET/Helpers/TemporaryFile.cs index 7abc92ff2a..a7631d3f15 100644 --- a/src/Magick.NET/Helpers/TemporaryFile.cs +++ b/src/Magick.NET/Helpers/TemporaryFile.cs @@ -11,7 +11,7 @@ internal sealed class TemporaryFile : IDisposable private readonly FileInfo _tempFile; public TemporaryFile() - => _tempFile = new FileInfo(Path.GetTempFileName()); + => _tempFile = new FileInfo(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString())); public long Length { diff --git a/tests/Magick.NET.Tests/TestHelpers/TemporaryFile.cs b/tests/Magick.NET.Tests/TestHelpers/TemporaryFile.cs index bc6ec5c1c1..eab1538d26 100644 --- a/tests/Magick.NET.Tests/TestHelpers/TemporaryFile.cs +++ b/tests/Magick.NET.Tests/TestHelpers/TemporaryFile.cs @@ -12,7 +12,7 @@ public class TemporaryFile : IDisposable public TemporaryFile(byte[] data) { - _file = new FileInfo(Path.GetTempFileName()); + _file = new FileInfo(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString())); System.IO.File.WriteAllBytes(_file.FullName, data); }