From 764e228a1b97ba26fb7fe0050afb736f77f61eee Mon Sep 17 00:00:00 2001 From: Thiago Lunardi Date: Sat, 28 Dec 2024 15:02:17 +0100 Subject: [PATCH] Ensure certificate directory exists before creating it --- application/AppHost/SslCertificateManager.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/application/AppHost/SslCertificateManager.cs b/application/AppHost/SslCertificateManager.cs index a4d54392c..fa17ef559 100644 --- a/application/AppHost/SslCertificateManager.cs +++ b/application/AppHost/SslCertificateManager.cs @@ -46,6 +46,16 @@ private static void CreateNewSelfSignedDeveloperCertificate(string certificateLo File.Delete(certificateLocation); } + else + { + var certificateDirectory = Path.GetDirectoryName(certificateLocation)!; + if (!Directory.Exists(certificateDirectory)) + { + Console.WriteLine($"Certificate directory {certificateDirectory} does not exist. Creating it."); + + Directory.CreateDirectory(certificateDirectory); + } + } Process.Start(new ProcessStartInfo {