Use Mono.Unix instead of shelling out to whoami

This commit is contained in:
Simon Pither 2010-06-14 10:14:00 +01:00 committed by Hylke Bons
parent 172cbe1286
commit 75d770eb02

View file

@ -51,9 +51,8 @@ namespace SparkleShare {
} }
// Don't allow running as root // Don't allow running as root
Process.StartInfo.FileName = "whoami"; UnixUserInfo UnixUserInfo = new UnixUserInfo (UnixEnvironment.UserName);
Process.Start (); if (UnixUserInfo.UserId == 0) {
if (Process.StandardOutput.ReadToEnd ().Trim ().Equals ("root")) {
Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions.")); Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions."));
Console.WriteLine (_("Things will go utterly wrong.")); Console.WriteLine (_("Things will go utterly wrong."));
Environment.Exit (0); Environment.Exit (0);