[Gambas-user] [Gambas Bug Tracker] Bug #973: Desktop.RunAsRoot(): file or directory doesn't exist

bugtracker at ...3416... bugtracker at ...3416...
Sat Aug 13 13:28:46 CEST 2016


http://gambaswiki.org/bugtracker/edit?object=BUG.973&from=L21haW4-

Comment #8 by Mufeed ALI:

Correction:

Public Sub RunAsRoot(Command As String, Optional SuApp As Integer)
  Dim sDE As String
  Command = System.Find("define")
  Shell "echo $XDG_CURRENT_DESKTOP" To sDE
  If SuApp = 1 Then
    Exec ["kdesudo", Command]
  Else If SuApp = 2 Then
    Exec ["gksudo", Command]
  Else If SuApp = 3 Then
    Exec ["lxde-sudo", Command]
  Else
    If InStr(sDE, "KDE", gb.IgnoreCase) Then
      Exec ["kdesudo", Command]
    Else If InStr(sDE, "LXQT", gb.IgnoreCase) Then
      Exec ["lxde-sudo", Command]
    Else If InStr(sDE, "Unity", gb.IgnoreCase) Or InStr(sDE, "GNOME", gb.IgnoreCase) Or InStr(sDE, "XFCE", gb.IgnoreCase) Or InStr(sDE, "LXDE", gb.IgnoreCase) Or InStr(sDE, "cinnamon", gb.IgnoreCase) Or InStr(sDE, "Mate", gb.IgnoreCase) Or InStr(sDE, "Pantheon", gb.IgnoreCase) Or InStr(sDE, "Budgie-Desktop", gb.IgnoreCase) Then
      Exec ["gksudo", Command]
    Endif
  Endif
End






More information about the User mailing list