Skip to content

Commit 799efaf

Browse files
committed
Fix .NET Framework native OpenVINO loading path
1 parent b3ca13c commit 799efaf

2 files changed

Lines changed: 1 addition & 24 deletions

File tree

src/Sdcb.OpenVINO/Natives/NativeMethods.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ public static partial class NativeMethods
1111
{
1212
static NativeMethods()
1313
{
14-
#if LINQPAD || NETCOREAPP3_1_OR_GREATER
1514
OpenVINOLibraryLoader.Init();
16-
#elif NETSTANDARD2_0_OR_GREATER || NET45_OR_GREATER
17-
OpenVINOLibraryLoader.WindowsNetFXLoad();
18-
#endif
1915
}
2016

2117
/// <summary>

src/Sdcb.OpenVINO/Natives/OpenVINOLibraryLoader.cs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Diagnostics;
4-
using System.IO;
53
using System.Linq;
64
using System.Reflection;
75
using System.Runtime.InteropServices;
@@ -13,28 +11,11 @@ namespace Sdcb.OpenVINO.Natives;
1311

1412
internal static class OpenVINOLibraryLoader
1513
{
16-
internal static void WindowsNetFXLoad()
17-
{
18-
if (!IsAndroid())
19-
{
20-
string libsPath = Path.GetDirectoryName(Process.GetCurrentProcess().Modules.Cast<ProcessModule>()
21-
.Single(x => Path.GetFileNameWithoutExtension(x.ModuleName) == "openvino_c")
22-
.FileName)!;
23-
AddLibPathToWindowsEnvironment(libsPath);
24-
}
25-
}
26-
2714
internal static bool IsAndroid()
2815
{
2916
return Environment.OSVersion.Platform == PlatformID.Unix && Environment.GetEnvironmentVariable("ANDROID_ROOT") != null;
3017
}
3118

32-
internal static void AddLibPathToWindowsEnvironment(string libPath)
33-
{
34-
const string envId = "PATH";
35-
Environment.SetEnvironmentVariable(envId, Environment.GetEnvironmentVariable(envId) + Path.PathSeparator + libPath);
36-
}
37-
3819
/// <summary>
3920
/// Initializes the OpenVINO library loader.
4021
/// </summary>
@@ -122,4 +103,4 @@ static IntPtr LoadWithDeps(Assembly assembly, DllImportSearchPath? searchPath, p
122103
#endif
123104
}
124105

125-
internal record LibDeps(string LibraryName, string[] KnownDependencies);
106+
internal record LibDeps(string LibraryName, string[] KnownDependencies);

0 commit comments

Comments
 (0)