[Gambas-user] Delete a file requiring Admin privilege

Tobias Boege taboege at ...626...
Sat Feb 2 20:17:45 CET 2013


On Sat, 02 Feb 2013, John Rose wrote:
> Tobias,
> 
> OK that solves a simple example using Exec. Perhaps I should have given 
> a more complex example: one where the directory contains a space and/or 
> the filename contains a space:
> 

It should work with as much spaces in the filenames as you want.

> The following works OK:
>    sPath = "/home/john/Temp orary/q w.desktop"
>    sLogPath = "/home/john/Temporary/Log.txt"
>    Wait 1
>    sCommand = "desktop-file-install " & " " &
>                          Shell$(sPath) &
>                          " >/dev/null 2>" & Shell$(sLogPath)
>    hProcess = Shell sCommand
>    Do
>      Wait 0.1
>    Loop Until hProcess.State <> Process.Running
> 
> But the following comes back with the help lines for gksudo i.e. where 
> it does not understand the rest:
>    sPath = "/home/john/Temp orary/q.desktop"
>    Exec ["desktop-file-install", sPath] Wait
> PS If I change sPath to not have a space in the directory (e.g. using 
> Temporary) but having a space in the filename (e.g. q w.desktop) then I 
> get the same.

Where do gksudo messages come from in this code snippet? You call
desktop-file-install and not gksudo.

Well, I tested the following code:

Exec ["kdesu", "desktop-file-install", "/home/user/dir space/desktop space.desktop"]

with success. Whatever it's worth for, the file landed in
/usr/share/applications.

I suspect that there is a subtile difference between kdesu and gksudo.

Regards,
Tobi




More information about the User mailing list