ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/fbintf/client/include/wloadlibrary.inc
(Generate patch)

Comparing ibx/trunk/fbintf/client/include/wloadlibrary.inc (file contents):
Revision 67 by tony, Mon Mar 6 10:20:02 2017 UTC vs.
Revision 68 by tony, Tue Oct 17 10:07:58 2017 UTC

# Line 36 | Line 36 | procedure TFBClientAPI.LoadIBLibrary;
36    end;
37    {$ENDIF}
38  
39 + var curPath: string;
40 +
41 +  procedure Add2Path(dirname: string);
42 +  var newPath: string;
43 +  begin
44 +    newPath := dirname + ';' + curPath;
45 +    SetEnvironmentVariable('PATH',PChar(newPath));
46 +  end;
47 +
48   var InstallDir: string;
49      dllPathName: string;
50      oldFirebirdEV: string;
51   begin
52    if IsValidHandle(IBLibrary) then Exit;
53  
54 +  curPath := GetEnvironmentVariable('PATH');
55 +
56    {First try any user override}
57    dllPathName := GetOverrideLibName;
58    if dllPathName <> '' then
# Line 87 | Line 98 | begin
98      begin
99        //assume firebird.conf and firebird.msg in same dir
100        dllPathName := InstallDir + FIREBIRD_CLIENT;
101 +      Add2Path(InstallDir);
102        IBLibrary := DoLoadLibrary(dllPathName)
103      end
104      else
105 <    if (InstallDir <> '') and FileExists(InstallDir + 'bin' + DirectorySeparator + FIREBIRD_CLIENT) then
105 >    if (InstallDir <> '') then
106      begin
107 <      dllPathName := InstallDir + FIREBIRD_CLIENT;
108 <      IBLibrary := DoLoadLibrary(dllPathName)
107 >      InstallDir := InstallDir + 'bin' + DirectorySeparator;
108 >      if FileExists(InstallDir + FIREBIRD_CLIENT) then
109 >      begin
110 >        dllPathName := InstallDir +  FIREBIRD_CLIENT;
111 >        Add2Path(InstallDir);
112 >        IBLibrary := DoLoadLibrary(dllPathName)
113 >      end
114      end
115    end;
116  
117    if not IsValidHandle(IBLibrary) then
118 <  {Use Registry key if it exists to locate library}
118 >  {Use Registry key if it exists to locate library Firebird 2 only}
119    begin
120      with TRegistry.Create do
121      try
# Line 109 | Line 126 | begin
126          begin
127            InstallDir := ReadString('DefaultInstance')  + 'bin' + DirectorySeparator ;
128            dllPathName := InstallDir + FIREBIRD_CLIENT;
129 +          Add2Path(InstallDir);
130            IBLibrary := DoLoadLibrary(dllPathName)
131          end
132        end
# Line 120 | Line 138 | begin
138      if not IsValidHandle(IBLibrary) then
139      begin
140        InstallDir := GetSpecialFolder(CSIDL_PROGRAM_FILES) +
141 <        DirectorySeparator + 'Firebird' +
142 <        DirectorySeparator + 'Firebird_3_0' +
143 <        DirectorySeparator + 'bin' + DirectorySeparator;
144 <      dllPathName := InstallDir + FIREBIRD_CLIENT;
141 >        'Firebird' +
142 >        DirectorySeparator + 'Firebird_3_0' + DirectorySeparator;
143 >      dllPathName := InstallDir  + FIREBIRD_CLIENT;
144 >      Add2Path(InstallDir);
145        IBLibrary := DoLoadLibrary(dllPathName)
146      end;
147  
148      if not IsValidHandle(IBLibrary) then
149      begin
150        InstallDir := GetSpecialFolder(CSIDL_PROGRAM_FILES) +
151 <        DirectorySeparator + 'Firebird' +
151 >        'Firebird' +
152          DirectorySeparator + 'Firebird_2_5' +
153          DirectorySeparator + 'bin' + DirectorySeparator;
154        dllPathName := InstallDir + FIREBIRD_CLIENT;
155 +      Add2Path(InstallDir);
156        IBLibrary := DoLoadLibrary(dllPathName)
157      end;
158  
159      if not IsValidHandle(IBLibrary) then
160      begin
161        InstallDir := GetSpecialFolder(CSIDL_PROGRAM_FILES) +
162 <        DirectorySeparator + 'Firebird' +
162 >        'Firebird' +
163          DirectorySeparator + 'Firebird_2_1' +
164          DirectorySeparator + 'bin' + DirectorySeparator;
165        dllPathName := InstallDir + FIREBIRD_CLIENT;
166 +      Add2Path(InstallDir);
167        IBLibrary := DoLoadLibrary(dllPathName)
168      end;
169  
# Line 151 | Line 171 | begin
171      //and rely on registry for location of firebird.conf and firebird.msg
172      if not IsValidHandle(IBLibrary) then
173      begin
174 +      SetEnvironmentVariable('PATH',PChar(curPath));
175        IBLibrary := DoLoadLibrary(FIREBIRD_CLIENT);
176        if IBLibrary <= HINSTANCE_ERROR then
177         //well maybe InterBase is present...

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines