Skip to content

Commit 6cb97a7

Browse files
committed
fixed windows build path problem
1 parent f231c7b commit 6cb97a7

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

wrapper/CSharp/wolfSSL-TLS-Server/wolfSSL-TLS-Server.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,19 @@ public static int my_sni_server_cb(IntPtr ssl, IntPtr ret, IntPtr exArg) {
8080
return 0;
8181
}
8282

83+
public static string setPath(string file) {
84+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
85+
{
86+
return @"../../certs/" + file;
87+
} else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
88+
{
89+
return @"../../../../certs/" + file;
90+
} else
91+
{
92+
return "";
93+
}
94+
}
95+
8396
public static void Main(string[] args)
8497
{
8598
IntPtr ctx;
@@ -88,8 +101,13 @@ public static void Main(string[] args)
88101
IntPtr arg_sni;
89102

90103
/* These paths should be changed for use */
91-
string fileCert = @"../../certs/server-cert.pem";
92-
string fileKey = @"../../certs/server-key.pem";
104+
string fileCert = setPath("server-cert.pem");
105+
string fileKey = setPath("server-key.pem");
106+
if (fileCert == "" || fileKey == "") {
107+
Console.WriteLine("Platform not supported.");
108+
return;
109+
}
110+
93111
StringBuilder dhparam = new StringBuilder("dh2048.pem");
94112

95113
StringBuilder buff = new StringBuilder(1024);

0 commit comments

Comments
 (0)