Skip to content

Commit b7b738c

Browse files
committed
feat: add GetClientLibraryPath() to FirebirdEnvironment
Exposes the Firebird client library path as a method on FirebirdEnvironment, following the same GetXxxPath() convention as GetServerPath(), GetIsqlPath(), etc. - Windows: returns fbclient.dll in the environment root - Linux: returns the versioned libfbclient.so.X (e.g. libfbclient.so.5), falling back to the unversioned libfbclient.so symlink Callers that need to supply an explicit library path to a Firebird client driver (e.g. python3-firebird-driver, firebird-driver .NET) can now use: \.GetClientLibraryPath() instead of writing OS-conditional path logic themselves. Add integration test to FirebirdEnvironment.Tests.ps1 verifying that the returned path exists and matches the expected filename pattern.
1 parent 567e51b commit b7b738c

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

Tests/FirebirdEnvironment.Tests.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,18 @@ Describe 'FirebirdEnvironment' -Tag 'Integration' {
6868
New-FirebirdEnvironment @FirebirdEnvParams -Path $TestEnvironmentPath @FirebirdExtraParams | Out-Null
6969
$LASTEXITCODE | Should -Be 0
7070
}
71+
72+
It 'GetClientLibraryPath returns the client library file' {
73+
$fbEnv = New-FirebirdEnvironment @FirebirdEnvParams -Path $TestEnvironmentPath @FirebirdExtraParams
74+
75+
$clientLib = $fbEnv.GetClientLibraryPath()
76+
77+
$clientLib | Should -Not -BeNullOrEmpty
78+
$clientLib | Should -Exist
79+
if ($IsWindows) {
80+
$clientLib.Path | Should -Match 'fbclient\.dll$'
81+
} else {
82+
$clientLib.Path | Should -Match 'libfbclient\.so'
83+
}
84+
}
7185
}

Types/FirebirdEnvironment.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,23 @@ class FirebirdEnvironment {
5555
return $this.GetFirebirdToolPath('nbackup')
5656
}
5757

58+
# Return the client library path (fbclient.dll on Windows, libfbclient.so.X on Linux)
59+
[System.Management.Automation.PathInfo] GetClientLibraryPath() {
60+
if ($global:IsWindows) {
61+
return Resolve-Path (Join-Path $this.Path 'fbclient.dll')
62+
}
63+
# Prefer the versioned .so.X form (e.g. libfbclient.so.5); fall back to the
64+
# unversioned symlink if no versioned file is found.
65+
$libDir = Join-Path $this.Path 'lib'
66+
$versioned = Get-ChildItem -Path $libDir -Filter 'libfbclient.so.*' -ErrorAction SilentlyContinue |
67+
Where-Object { $_.Name -match '\.so\.\d+$' } |
68+
Select-Object -First 1
69+
if ($versioned) {
70+
return Resolve-Path $versioned.FullName
71+
}
72+
return Resolve-Path (Join-Path $libDir 'libfbclient.so')
73+
}
74+
5875
# Private helper to get tool path
5976
hidden [System.Management.Automation.PathInfo] GetFirebirdToolPath([string]$tool) {
6077
$toolPath = if ($global:IsWindows) {

0 commit comments

Comments
 (0)