fix: auto-load libfbclient on macOS from Firebird.framework
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
6cbf0732e6
commit
35859e8d75
@@ -30,7 +30,17 @@ class FirebirdService:
|
|||||||
self.conn = None
|
self.conn = None
|
||||||
|
|
||||||
def connect(self, host: str, port: int, database: str, user: str, password: str):
|
def connect(self, host: str, port: int, database: str, user: str, password: str):
|
||||||
|
import platform, os
|
||||||
try:
|
try:
|
||||||
|
if platform.system() == "Darwin":
|
||||||
|
mac_lib = "/Library/Frameworks/Firebird.framework/Versions/A/Resources/lib/libfbclient.dylib"
|
||||||
|
if os.path.exists(mac_lib):
|
||||||
|
os.environ.setdefault("DYLD_LIBRARY_PATH",
|
||||||
|
"/Library/Frameworks/Firebird.framework/Versions/A/Resources/lib")
|
||||||
|
try:
|
||||||
|
fdb.load_api(mac_lib)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
self.conn = fdb.connect(
|
self.conn = fdb.connect(
|
||||||
host=host,
|
host=host,
|
||||||
port=port,
|
port=port,
|
||||||
|
|||||||
Reference in New Issue
Block a user