« Reply #16 on: May 14, 2024, 11:25:47 pm »
I found out that the real environment and the design environment need two separate approaches because when designing in Lazarus for Mac the actual running file is stored in the same directory as the app-bundle, BUT in the real environment the running file is stored INSIDE the bundle.
So I came up with this solution:
String1 := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)));
String2 := 'MacOS';
if Pos(String2, String1) <> 0 then
// Work Environment
ProgramDir := copy(String1, 1, length(String1) - 6)
else
// Design Environment
ProgramDir := Application.ExeName + '.app/Contents/';
« Last Edit: May 15, 2024, 10:12:05 am by madref »

Logged
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.
Main Platform:
--------------
Mac OS X Sonoma 14.7.4
Lazarus 4.99 (rev main_4_99-1378-ga4855f6fa5) FPC 3.3.1 x86_64-darwin-cocoa
Windows 10 Pro
Lazarus 3.99 (rev cbfd80ce39)