diff options
author | Jeremie Laval <jeremie.laval@gmail.com> | 2012-04-17 19:19:05 +0400 |
---|---|---|
committer | Jeremie Laval <jeremie.laval@gmail.com> | 2012-04-17 19:20:53 +0400 |
commit | 207e06c7413a127d2f4c23e74eebfaddbbbec2f1 (patch) | |
tree | 2048d3af59cfee4963ee3e6a2d02ce1b8d8a7f50 /RootLauncher.cs | |
parent | 93a6458221491bc30af39266b8df11cb35df3ea4 (diff) |
Make RootLauncher accepts arguments
Diffstat (limited to 'RootLauncher.cs')
-rw-r--r-- | RootLauncher.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/RootLauncher.cs b/RootLauncher.cs index 8e2d8d4..7d4cb01 100644 --- a/RootLauncher.cs +++ b/RootLauncher.cs @@ -1,6 +1,8 @@ using System; using System.IO; +using System.Linq; using System.Diagnostics; +using System.Collections.Generic; using System.Runtime.InteropServices; namespace macdoc @@ -39,7 +41,7 @@ namespace macdoc { const string SecurityFramework = "/System/Library/Frameworks/Security.framework/Versions/Current/Security"; - public static void LaunchExternalTool (string toolPath) + public static void LaunchExternalTool (string toolPath, params string[] args) { if (!File.Exists (toolPath)) throw new RootLauncherException ("[Launcher] Error, the tool doesn't exist and can't be launched") { ResultCode = AuthorizationResultCode.FileNotFound }; @@ -49,7 +51,7 @@ namespace macdoc if (result != AuthorizationResultCode.Success) throw new RootLauncherException ("[Launcher] Error while creating Auth Reference") { ResultCode = result }; - result = AuthorizationExecuteWithPrivileges (authReference, toolPath, 0, new string[] { null }, IntPtr.Zero); + result = AuthorizationExecuteWithPrivileges (authReference, toolPath, 0, (args ?? Enumerable.Empty<string> ()).Concat (Enumerable.Repeat ((string)null, 1)).ToArray (), IntPtr.Zero); if (result != AuthorizationResultCode.Success) throw new RootLauncherException ("[Launcher] Error while executing") { ResultCode = result }; } |