Преглед изворни кода

ADD: Pass arguments to the application under Mac OS X

Alexander Koblov пре 13 година
родитељ
комит
30d277882e
1 измењених фајлова са 8 додато и 3 уклоњено
  1. 8 3
      src/platform/uOSUtils.pas

+ 8 - 3
src/platform/uOSUtils.pas

@@ -260,11 +260,16 @@ begin
   // execute it by 'open -a' command (see 'man open' for details)
   // execute it by 'open -a' command (see 'man open' for details)
   if StrEnds(Command, '.app') then
   if StrEnds(Command, '.app') then
   begin
   begin
-    SetLength(Args, Length(Args) + 2);
-    for pid := High(Args) downto Low(Args) + 2 do
-      Args[pid]:= Args[pid - 2];
+    SetLength(Args, Length(Args) + 3);
+    for pid := High(Args) downto Low(Args) + 3 do
+      Args[pid]:= Args[pid - 3];
     Args[0] := '-a';
     Args[0] := '-a';
     Args[1] := Command;
     Args[1] := Command;
+    // Passing arguments to the application only supported starting with Mac OS X 10.6
+    if (Gestalt(gestaltSystemVersion, pid) = noErr) and (pid >= $1060) then
+      Args[2] := '--args'
+    else
+      SetLength(Args, 2);
     Command := 'open';
     Command := 'open';
   end;
   end;
   {$ENDIF}
   {$ENDIF}