Skip to content

Commit eccf7b2

Browse files
committed
fix: set MySQL plugins folder like in the classic branch
1 parent 825447f commit eccf7b2

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

source/apphelpers.pas

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,13 @@ TAppSettings = class(TObject)
349349
function FormatByteNumber( Bytes: Int64; Decimals: Byte = 1 ): String; Overload;
350350
function FormatByteNumber( Bytes: String; Decimals: Byte = 1 ): String; Overload;
351351
function FormatTimeNumber(Seconds: Double; DisplaySeconds: Boolean; MilliSecondsPrecision: Integer=1): String;
352-
//function GetTempDir: String;
352+
// Return directory of running executable, including a trailing path delimiter
353353
function GetAppDir: String;
354+
// Return directory with dlls or dylibs, or empty string for auto-detection
354355
function GetLibDir: String;
356+
// Return directory with MySQL plugin files. Empty on Linux inidicating auto-detection.
357+
function GetPluginDir: String;
358+
// Point to Resources dir in macOS app bundle, application dir in most other OSes
355359
function GetResourcesDir: String;
356360
procedure SaveUnicodeFile(Filename: String; Text: String; Encoding: TEncoding);
357361
procedure OpenTextFile(const Filename: String; out Stream: TFileStream; var Encoding: TEncoding);
@@ -1257,16 +1261,6 @@ function FormatTimeNumber(Seconds: Double; DisplaySeconds: Boolean; MilliSeconds
12571261
end;
12581262

12591263

1260-
{function GetTempDir: String;
1261-
var
1262-
TempPath: array[0..MAX_PATH] of Char;
1263-
begin
1264-
GetTempPath(MAX_PATH, PChar(@TempPath));
1265-
Result := StrPas(TempPath);
1266-
end;}
1267-
1268-
1269-
// Return directory of running executable, including a trailing path delimiter
12701264
function GetAppDir: String;
12711265
begin
12721266
Result := ExtractFilePath(Application.ExeName);
@@ -1288,10 +1282,20 @@ function GetLibDir: String;
12881282
{$ENDIF}
12891283
end;
12901284

1285+
function GetPluginDir: String;
1286+
begin
1287+
// Windows: reuse plugin directory from pre-v13 installations
1288+
// Linux: return empty string, indicating libmysql knows where to look at
1289+
// macOS: use the Frameworks directory, where all other libs reside
1290+
Result := GetLibDir;
1291+
{$IFDEF WINDOWS}
1292+
Result := Result + 'plugins' + DirectorySeparator;
1293+
{$ENDIF}
1294+
end;
1295+
12911296
function GetResourcesDir: String;
12921297
begin
12931298
Result := GetAppDir;
1294-
// point to resources dir in macOS app bundle
12951299
{$IFDEF DARWIN}
12961300
Result := GetAppDir + '..' + DirectorySeparator + 'Resources' + DirectorySeparator;
12971301
{$ENDIF}

source/dbconnection.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2464,9 +2464,9 @@ procedure TMySQLConnection.SetActive( Value: Boolean );
24642464
if Parameters.WantSSL and (not FLib.IsLibMariadb) then
24652465
ClientFlags := ClientFlags or CLIENT_SSL;
24662466

2467-
if not GetLibDir.IsEmpty then begin
2467+
if not GetPluginDir.IsEmpty then begin
24682468
// Point libmysql to the folder with client plugins
2469-
PluginDir := AnsiString(GetLibDir);
2469+
PluginDir := AnsiString(GetPluginDir);
24702470
SetOption(FLib.MYSQL_PLUGIN_DIR, PAnsiChar(PluginDir));
24712471
end;
24722472

0 commit comments

Comments
 (0)