Remove obsoleted code
This commit is contained in:
@@ -75,11 +75,7 @@ namespace OpenRA.Utility
|
|||||||
switch (Environment.OSVersion.Platform)
|
switch (Environment.OSVersion.Platform)
|
||||||
{
|
{
|
||||||
case PlatformID.Unix:
|
case PlatformID.Unix:
|
||||||
if (File.Exists("/usr/bin/gksudo"))
|
// Unix platforms are expected to run the utility as root
|
||||||
CallWithAdminGnome(command);
|
|
||||||
else if (File.Exists("/usr/bin/kdesudo"))
|
|
||||||
CallWithAdminKDE(command);
|
|
||||||
else
|
|
||||||
CallWithoutAdmin(command);
|
CallWithoutAdmin(command);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -88,50 +84,6 @@ namespace OpenRA.Utility
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CallWithAdminGnome(string command)
|
|
||||||
{
|
|
||||||
var p = new Process();
|
|
||||||
p.StartInfo.FileName = "/usr/bin/gksudo";
|
|
||||||
p.StartInfo.Arguments = "--description \"OpenRA Utility App\" -- mono OpenRA.Utility.exe " + command;
|
|
||||||
p.StartInfo.UseShellExecute = false;
|
|
||||||
p.StartInfo.RedirectStandardOutput = true;
|
|
||||||
p.Start();
|
|
||||||
|
|
||||||
using (var reader = p.StandardOutput)
|
|
||||||
{
|
|
||||||
while (!p.HasExited)
|
|
||||||
{
|
|
||||||
string line = reader.ReadLine();
|
|
||||||
if (string.IsNullOrEmpty(line)) continue;
|
|
||||||
if (line.Equals("GNOME_SUDO_PASSGNOME_SUDO_PASSSorry, try again.")) //gksudo is slightly moronic
|
|
||||||
{
|
|
||||||
Console.WriteLine("Error: Could not elevate process");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Console.WriteLine(line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void CallWithAdminKDE(string command)
|
|
||||||
{
|
|
||||||
var p = new Process();
|
|
||||||
p.StartInfo.FileName = "/usr/bin/kdesudo";
|
|
||||||
p.StartInfo.Arguments = "-d -- mono OpenRA.Utility.exe " + command;
|
|
||||||
p.StartInfo.UseShellExecute = false;
|
|
||||||
p.StartInfo.RedirectStandardOutput = true;
|
|
||||||
p.Start();
|
|
||||||
|
|
||||||
using (var reader = p.StandardOutput)
|
|
||||||
{
|
|
||||||
while(!p.HasExited)
|
|
||||||
{
|
|
||||||
Console.WriteLine(reader.ReadLine());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void CallWithAdminWindows(string command)
|
static void CallWithAdminWindows(string command)
|
||||||
{
|
{
|
||||||
string pipename = Util.GetPipeName();
|
string pipename = Util.GetPipeName();
|
||||||
|
|||||||
Reference in New Issue
Block a user