fixed windows build path problem

pull/7610/head
gasbytes 2024-06-04 23:12:16 +02:00
parent f231c7be03
commit 6cb97a7262
1 changed files with 20 additions and 2 deletions

View File

@ -80,6 +80,19 @@ public class wolfSSL_TLS_CSHarp
return 0;
}
public static string setPath(string file) {
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return @"../../certs/" + file;
} else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return @"../../../../certs/" + file;
} else
{
return "";
}
}
public static void Main(string[] args)
{
IntPtr ctx;
@ -88,8 +101,13 @@ public class wolfSSL_TLS_CSHarp
IntPtr arg_sni;
/* These paths should be changed for use */
string fileCert = @"../../certs/server-cert.pem";
string fileKey = @"../../certs/server-key.pem";
string fileCert = setPath("server-cert.pem");
string fileKey = setPath("server-key.pem");
if (fileCert == "" || fileKey == "") {
Console.WriteLine("Platform not supported.");
return;
}
StringBuilder dhparam = new StringBuilder("dh2048.pem");
StringBuilder buff = new StringBuilder(1024);