[Gambas-user] Desktop.Open [,Wait], what does it do?

Benoît Minisini gambas at ...1...
Sun Nov 23 13:17:42 CET 2014


Le 23/11/2014 06:38, T Lee Davidson a écrit :
> On 11/22/2014 03:04 PM, Tobias Boege wrote:
>> Apparently it waits for the xdg script to terminate. There is no relation to
>> the actually launched application -- the xdg script can a priori terminate
>> before the application window emerges, or it can terminate even after the
>> launched application did (if it's very short-lived), or everything between
>> these extremes.
>>
>> But when Wait = True, Desktop.Open() tries to report errors that happened
>> during running the xdg script. You can answer these questions yourself, too,
>> if you care to do that, by looking at the source code. gb.desktop is written
>> in Gambas. The particular sources I got these answers from are [0] and [1].
>>
>> Regards,
>> Tobi
>>
>> [0]http://sourceforge.net/p/gambas/code/HEAD/tree/gambas/trunk/comp/src/gb.desktop/.src/Desktop.class
>> [1]http://sourceforge.net/p/gambas/code/HEAD/tree/gambas/trunk/comp/src/gb.desktop/.src/Main.module
>
> Thank you, Tobi. Those links helped me get right to it. I can now see
> the difference clearly.
>
> I have updated the documentation
> (http://gambaswiki.org/wiki/comp/gb.desktop/desktop/open) based on your
> response.
>
>
> However, Desktop.Open with Wait=True does not Error.Raise("The action
> has failed") when it should.
>
> On the command-line, `xdg-open doesnotexist.txt` causes an error message
> box to pop up and exits with a status code of 4, which is "The action
> failed." (It sure would be nice if xdg-open provided a --quiet option.)
>
> The following code in a form, when executed, prints no errors:
>
> Public Sub Button1_Click()
>
>     Try Desktop.Open("doesnotexist.txt", True)
>     If Error Then Print Error.Text
>
>     Catch
>       Print Error.Text
>
> End
>
>
> So, perhaps the documentation revision I just made is not entirely
> correct in practice.
>
>

I guess it's not my fault: the 'kde-open' executable (which is used by 
xdg-open on KDE) returns "0" inside the script, whereas it returns "1" 
when run from the shell. So 'xdg-open' thinks it has been successfull. 
And I have no idea how it could be possible...

Regards,

-- 
Benoît Minisini




More information about the User mailing list