Skip to content

Commit

Permalink
[release/8.0-preview1] Cherry-pick temp path changes (#626)
Browse files Browse the repository at this point in the history
* Use Directory.CreateTempSubdirectory (#607)

* Use Directory.CreateTempSubdirectory

The advantage here is that the folder gets the correct permissions on Unix.

* Improvements for temp paths and OS check (#624)

---------

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
  • Loading branch information
danegsta and eerhardt authored Nov 2, 2023
1 parent f506e69 commit 6e1c4b3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Aspire.Hosting/Dcp/DcpHostService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Globalization;
using System.IO.Pipelines;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;
using Aspire.Dashboard;
using Aspire.Dashboard.Model;
Expand Down Expand Up @@ -264,7 +263,7 @@ private static Socket CreateLoggingSocket(string socketPath)
string? directoryName = Path.GetDirectoryName(socketPath);
if (!string.IsNullOrEmpty(directoryName))
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
if (OperatingSystem.IsWindows())
{
Directory.CreateDirectory(directoryName);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting/DistributedApplicationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public DistributedApplicationBuilder(DistributedApplicationOptions options)
_innerBuilder.Services.AddHostedService<DcpHostService>();

// We need a unique path per application instance
var path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
var path = Directory.CreateTempSubdirectory("aspire.").FullName;
_innerBuilder.Services.AddSingleton(new Locations(path));
_innerBuilder.Services.AddSingleton<KubernetesService>();

Expand Down

0 comments on commit 6e1c4b3

Please sign in to comment.