mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-26 00:02:36 +02:00
26 lines
648 B
PHP
26 lines
648 B
PHP
{%MainUnit ../lclintf.pas}
|
|
|
|
// Open a given URL with the default browser
|
|
function OpenURL(AURL: String): Boolean;
|
|
var
|
|
cf: CFStringRef;
|
|
url: CFURLRef;
|
|
begin
|
|
if AURL = '' then
|
|
Exit(False);
|
|
cf := CFStringCreateWithCString(kCFAllocatorDefault, @AURL[1], kCFStringEncodingUTF8);
|
|
if not Assigned(cf) then
|
|
Exit(False);
|
|
url := CFURLCreateWithString(nil, cf, nil);
|
|
Result := LSOpenCFURLRef(url, nil) = 0;
|
|
CFRelease(url);
|
|
CFRelease(cf);
|
|
end;
|
|
|
|
// Open a document with the default application associated with it in the system
|
|
function OpenDocument(APath: String): Boolean;
|
|
begin
|
|
Result := True;
|
|
RunCmdFromPath('open',APath);
|
|
end;
|