[Gambas-user] Get the default file manager

Bruce Steers bsteers4 at gmail.com
Sun Feb 18 20:45:19 CET 2024


On Sun, 18 Feb 2024 at 18:18, Bruce Steers <bsteers4 at gmail.com> wrote:

>
>
> On Sun, 18 Feb 2024 at 15:44, Benoît Minisini <
> benoit.minisini at gambas-basic.org> wrote:
>
>> Le 18/02/2024 à 13:28, Bruce Steers a écrit :
>> >
>>
>>
<snip>

Instead of adding a boolean argument, can't you just make the default
>> application always the first application of the returned array?
>>
>> --
>> Benoît Minisini.
>>
>
> Yes i think so.
> I removed last changes and re did it..
>
> It first looks for the mime in [Default Applications] slot and notes the
> result
> My initial way was flawed in a few ways, i could get the default but it
> would omit others..
> I worked around it like this
>

<snip>


> Note: i also needed to remove the caching...
> $cMimeCache[sMime] = hProgList
> as it gets cached to a Collection then the order of items gets jumbled!
> So it would work the first time then the second time be wrong :(
>

Right sorry i was wrong about the cache messing things up.
I
 figured out the problem was if the type was text/something and not plain
then text/plain is added as a mime types to also show.

The problem was it was added like say:  ["text/html", "text/plain"] So the
default for plain was put at the top of the results

fixed by adding text/plain as the first item not second, making it
["text/plain", "text/html"]
Then when text/html is searched secondly the default put to the top of the
list is then correct for the specific type.

Respects
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20240218/16be8a41/attachment.htm>


More information about the User mailing list