[Gambas-user] Delete a file requiring Admin privilege
Tobias Boege
taboege at ...626...
Sun Feb 3 21:27:17 CET 2013
On Sun, 03 Feb 2013, John Rose wrote:
> Apologies, my mistake. Instead of saying that
> Exec ["gksudo", "desktop-file-install, sPath]
> or
> Exec ["gksudo", Shell$("desktop-file-install", Shell$(sPath))]
> did not work.
>
> I should have said that
> Exec ["gksudo", "desktop-file-install", sPath] To sOutput
> did work: where, for example, sPath="/home/john/Temp orary/q w.desktop".
> and
> Exec ["gksudo", "desktop-file-install", "--dir=" & sInstallDirectory,
> sPath] To sOutput
> did not work (i.e. sOutput gives 'help for gksudo'): where, for example,
> sInstallDirectory= "/usr/share/applications" and
> sPath="/home/john/Temporary/q.desktop".
> and
> Exec ["gksudo", "desktop-file-install", Shell$("--dir=" &
> sInstallDirectory), Shell$(sPath)] To sOutput
> did not work (i.e. sOutput gives 'help for gksudo'): where, for example,
> sInstallDirectory= "/usr/share/applications" and
> sPath="/home/john/Temporary/q.desktop".
>
> In other words, the "--dir" option causes the problem not the space in
> the directory or filename.
>
> Could someone check this to confirm or not that I am correct?
I finally saw your error! It states _explicitly_ that the switch --dir is
not known to gksudo. The standard way to prevent programs from interpreting
arguments as their switches is to put "--" somewhere before that argument:
sPath = User.Home &/ "desktop space.desktop"
sInstallPath = User.Home &/ "dir space"
Exec ["gksudo", "--", "desktop-file-install", "--dir=" & sInstallPath, sPath]
Works perfectly here. It even creates the "dir space" directory for me.
This is clearly an application-specific problem. Bug #400 is invalid not
only because of your project.
Regards,
Tobi
More information about the User
mailing list