@@ -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
12571261end ;
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
12701264function GetAppDir : String;
12711265begin
12721266 Result := ExtractFilePath(Application.ExeName);
@@ -1288,10 +1282,20 @@ function GetLibDir: String;
12881282 { $ENDIF}
12891283end ;
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+
12911296function GetResourcesDir : String;
12921297begin
12931298 Result := GetAppDir;
1294- // point to resources dir in macOS app bundle
12951299 { $IFDEF DARWIN}
12961300 Result := GetAppDir + ' ..' + DirectorySeparator + ' Resources' + DirectorySeparator;
12971301 { $ENDIF}
0 commit comments