mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
ADD: Implement ShellExecute for Mac OS X
This commit is contained in:
parent
82a3791644
commit
9e8988e35e
1 changed files with 16 additions and 2 deletions
|
|
@ -554,12 +554,26 @@ end;
|
|||
{$ENDIF}
|
||||
|
||||
function ShellExecute(URL: String): Boolean;
|
||||
{$IFDEF MSWINDOWS}
|
||||
{$IF DEFINED(MSWINDOWS)}
|
||||
begin
|
||||
Result:= ExecCmdFork(Format('"%s"', [URL]));
|
||||
if Result = False then
|
||||
Result:= ExecCmdFork('rundll32 shell32.dll OpenAs_RunDLL ' + URL);
|
||||
end;
|
||||
{$ELSEIF DEFINED(DARWIN)}
|
||||
var
|
||||
theFileNameCFRef: CFStringRef;
|
||||
theFileNameUrlRef: CFURLRef;
|
||||
theFileNameFSRef: FSRef;
|
||||
begin
|
||||
Result:= False;
|
||||
theFileNameCFRef:= CFStringCreateWithFileSystemRepresentation(nil, PAnsiChar(URL));
|
||||
theFileNameUrlRef:= CFURLCreateWithFileSystemPath(nil, theFileNameCFRef, kCFURLPOSIXPathStyle, False);
|
||||
if (CFURLGetFSRef(theFileNameUrlRef, theFileNameFSRef)) then
|
||||
begin
|
||||
Result:= (LSOpenFSRef(theFileNameFSRef, nil) = noErr);
|
||||
end;
|
||||
end;
|
||||
{$ELSE}
|
||||
var
|
||||
DesktopEnv: Cardinal;
|
||||
|
|
@ -818,7 +832,7 @@ begin
|
|||
if PathPrefix = '' then
|
||||
PathPrefix := GetTempDir;
|
||||
repeat
|
||||
Result := PathPrefix + IntToStr(Random(MaxInt)); // or use CreateGUID()
|
||||
Result := PathPrefix + IntToStr(System.Random(MaxInt)); // or use CreateGUID()
|
||||
Inc(TryNumber);
|
||||
if TryNumber = MaxTries then
|
||||
Exit('');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue