mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 22:09:28 +02:00
cocoa: updating OpenDocument api to handle URLs as well (similar to Win32)
git-svn-id: trunk@61175 -
This commit is contained in:
parent
7bee5358e4
commit
17928418c1
@ -21,10 +21,13 @@ var
|
||||
begin
|
||||
Result := False;
|
||||
if AURL = '' then
|
||||
Exit(False);
|
||||
url := NSURL.URLWithString(NSStr(@AURL[1]));
|
||||
if not Assigned(url) then
|
||||
Exit(False);
|
||||
Exit;
|
||||
url := NSURL.URLWithString(NSString.stringWithUTF8String(@AURL[1]));
|
||||
// scheme is checking for "protocol" specifier.
|
||||
// if no protocol specifier exist - do not consider it as URL and fail
|
||||
if not Assigned(url) or (url.scheme.length = 0) then
|
||||
Exit;
|
||||
|
||||
ws := NSWorkspace.sharedWorkspace;
|
||||
Result := ws.openURL(url);
|
||||
end;
|
||||
@ -33,9 +36,14 @@ end;
|
||||
function OpenDocument(APath: String): Boolean;
|
||||
var
|
||||
ResultingPath: string;
|
||||
lpath: string;
|
||||
begin
|
||||
Result := True;
|
||||
if not FileExistsUTF8(APath) then exit(false);
|
||||
if not FileExistsUTF8(APath) then begin
|
||||
// Windows OpenDocument handles URLs as well
|
||||
Result := OpenURL(Apath);
|
||||
Exit;
|
||||
end;
|
||||
// Paths with spaces need to be quoted, see bug 21651
|
||||
if (APath<>'') and (APath[1]<>'''') then
|
||||
ResultingPath:=QuotedStr(APath)
|
||||
|
Loading…
Reference in New Issue
Block a user