FpDebug: MacOs, find dwarf info in app bundle

git-svn-id: trunk@58307 -
This commit is contained in:
martin 2018-06-18 13:16:32 +00:00
parent 808d854163
commit 0db8c632c5

View File

@ -4,6 +4,8 @@ unit FpImgReaderBase;
{$modeswitch advancedrecords}
interface
{$ifdef CD_Cocoa}{$DEFINE MacOS}{$ENDIF}
{$IFDEF Darwin}{$DEFINE MacOS}{$ENDIF}
uses
{$ifdef windows}
@ -142,12 +144,23 @@ end;
{ TDbgFileLoader }
constructor TDbgFileLoader.Create(AFileName: String);
{$IFDEF MacOS}
var
s: String;
{$ENDIF}
begin
{$ifdef USE_WIN_FILE_MAPPING}
FFileHandle := CreateFile(PChar(AFileName), GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
Create(FFileHandle);
{$else}
FList := TList.Create;
{$IFDEF MacOS}
if (RightStr(AFileName,4) = '.app') then begin
s := ExtractFileName(AFileName);
s := AFileName + PathDelim + 'Contents' + PathDelim + 'MacOs' + PathDelim + copy(s, 1, Length(s) - 4);
if (FileExists(s)) then AFileName := s
end;
{$ENDIF}
FStream := TFileStreamUTF8.Create(AFileName, fmOpenRead or fmShareDenyNone);
inherited Create;
{$endif}