[Gambas-user] Get the default file manager

Benoît Minisini benoit.minisini at gambas-basic.org
Sun Feb 18 16:43:38 CET 2024


Le 18/02/2024 à 13:28, Bruce Steers a écrit :
> 
> In the attached gb.desktop DesktopFile.class I have added a DefaultOnly 
> option to DesktopFile.FromMime(Type As String, Optional DefaultOnly As 
> Boolean)
> And the same option to the Private  FindInMimeInfoCache function
> 
> If you make DefaultOnly True it only returns the "Default Applications" 
> found and skips all the "Associated Applications" by first moving the 
> position to the [Default Applications] slot
> 
> So i can now simply use...
> 
> DesktopFile.FromMime("inode/directory", True)[0].Run(User.home)
> 
> Seems to work okay I only get one result and yes its caja :)
> 
> Maybe Benoit could add something similar to only return the Default 
> application not all associated apps?
> 
> To make this work Martin just remove gb.desktop from your program 
> components and add the attached folder to your .src folder
> 
> Respects
> BruceS
> 

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.



More information about the User mailing list