From 2e29cdf34b9f490fb4dd5300f16fda8ad5fa1a8d Mon Sep 17 00:00:00 2001 From: xieguigang Date: Sat, 19 Jun 2021 02:04:21 +0800 Subject: [PATCH] get driver dll file --- LINQ/LINQ/Runtime/Registry.vb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/LINQ/LINQ/Runtime/Registry.vb b/LINQ/LINQ/Runtime/Registry.vb index 8ac7fb0..9cfc199 100644 --- a/LINQ/LINQ/Runtime/Registry.vb +++ b/LINQ/LINQ/Runtime/Registry.vb @@ -42,6 +42,7 @@ Imports System.Reflection Imports LINQ.Runtime.Drivers +Imports Microsoft.VisualBasic.Language Namespace Runtime @@ -68,7 +69,23 @@ Namespace Runtime End Sub Private Function getDllFile(driver As String) As String + If driver.FileExists Then + Return driver + End If + + Dim fileName As Value(Of String) = "" + + If driver.ExtensionSuffix <> "dll" Then + driver = $"{driver}.dll" + End If + + For Each dir As String In {App.HOME, App.CurrentDirectory} + If (fileName = $"{dir}/{driver}").FileExists Then + Return fileName + End If + Next + Throw New BadImageFormatException($"driver module '{driver}' not found!") End Function Public Function GetTypeCodeName(type As Type) As String