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

bugtracker at ...3416... bugtracker at ...3416...
Wed Aug 10 11:06:38 CEST 2016


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

Comment #7 by Mufeed ALI:

Public Sub RunAsRoot(Command As String, Optional SuApp As Integer)  
  Dim sDE As String
  Dim 
  Command = System.Find("define")
  Shell "echo $XDG_CURRENT_DESKTOP" To sDE
  Print Command
  Print sDE
  If SuApp = 1 Then
    Exec ["kdesudo", Command]
  Else If SuApp = 2 Then
    Exec ["gksudo", Command]
  Else If SuApp = 3 Then
    Shell "xterm -e " & Quote("sudo " & Command)
  Else
    If InStr(sDE, "KDE", gb.IgnoreCase) Then
      Exec ["kdesudo", Command]
    Else If InStr(sDE, "KDE", 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) Then
      Exec ["gksudo", Command]
    Endif
  Endif
End

Hope this works for now. Sorry, my pc got damaged, so I couldn't  send this in.






More information about the User mailing list