@@ -1487,7 +1487,9 @@ constructor TConnectionParameters.Create(SessionRegPath: String);
14871487 FPort := MakeInt(AppSettings.ReadString(asPort));
14881488 FCompressed := AppSettings.ReadBool(asCompressed);
14891489 FAllDatabases := AppSettings.ReadString(asDatabases);
1490- FLibraryOrProvider := AppSettings.ReadString(asLibrary, ' ' , DefaultLibrary);
1490+ FLibraryOrProvider := AppSettings.ReadString(asLibrary);
1491+ if not FileExists(GetLibDir + FLibraryOrProvider) then
1492+ FLibraryOrProvider := DefaultLibrary; // Catches empty string and any non-existant file
14911493 FComment := AppSettings.ReadString(asComment);
14921494
14931495 // Auto-activate SSH for sessions created before asSSHtunnelActive was introduced
@@ -2049,7 +2051,7 @@ function TConnectionParameters.GetLibraries: TStringList;
20492051 end ;
20502052 case NetTypeGroup of
20512053 ngMySQL, ngPgSQL, ngSQLite, ngInterbase: begin
2052- Dlls := TDirectory.GetFiles(GetAppDir , ' *.dll' );
2054+ Dlls := TDirectory.GetFiles(GetLibDir , ' *.dll' );
20532055 for DllPath in Dlls do begin
20542056 DllFile := ExtractFileName(DllPath);
20552057 if rx.Exec(DllFile) then begin
@@ -2540,9 +2542,11 @@ procedure TMySQLConnection.SetActive( Value: Boolean );
25402542 if Parameters.WantSSL and (not FLib.IsLibMariadb) then
25412543 ClientFlags := ClientFlags or CLIENT_SSL;
25422544
2543- // Point libmysql to the folder with client plugins
2544- PluginDir := AnsiString(GetAppDir+' plugins' );
2545- SetOption(FLib.MYSQL_PLUGIN_DIR, PAnsiChar(PluginDir));
2545+ if not GetPluginDir.IsEmpty then begin
2546+ // Point libmysql to the folder with client plugins
2547+ PluginDir := AnsiString(GetPluginDir);
2548+ SetOption(FLib.MYSQL_PLUGIN_DIR, PAnsiChar(PluginDir));
2549+ end ;
25462550
25472551 // Enable cleartext plugin
25482552 if Parameters.CleartextPluginEnabled then
@@ -3309,7 +3313,7 @@ procedure TMySQLConnection.DoBeforeConnect;
33093313 LibraryPath: String;
33103314begin
33113315 // Init libmysql before actually connecting.
3312- LibraryPath := GetAppDir + Parameters.LibraryOrProvider;
3316+ LibraryPath := GetLibDir + Parameters.LibraryOrProvider;
33133317 Log(lcDebug, f_(' Loading library file %s ...' , [LibraryPath]));
33143318 // Throws EDbError on any failure:
33153319 FLib := TMySQLLib.Create(LibraryPath, Parameters.DefaultLibrary);
@@ -3324,7 +3328,7 @@ procedure TPgConnection.DoBeforeConnect;
33243328 msg: String;
33253329begin
33263330 // Init lib before actually connecting.
3327- LibraryPath := GetAppDir + Parameters.LibraryOrProvider;
3331+ LibraryPath := GetLibDir + Parameters.LibraryOrProvider;
33283332 Log(lcDebug, f_(' Loading library file %s ...' , [LibraryPath]));
33293333 try
33303334 FLib := TPostgreSQLLib.Create(LibraryPath, Parameters.DefaultLibrary);
@@ -3355,7 +3359,7 @@ procedure TSQLiteConnection.DoBeforeConnect;
33553359 LibraryPath: String;
33563360begin
33573361 // Init lib before actually connecting.
3358- LibraryPath := GetAppDir + Parameters.LibraryOrProvider;
3362+ LibraryPath := GetLibDir + Parameters.LibraryOrProvider;
33593363 Log(lcDebug, f_(' Loading library file %s ...' , [LibraryPath]));
33603364 // Throws EDbError on any failure:
33613365 if Parameters.NetType = ntSQLite then
0 commit comments