Hi all I’m working on a cross operating system method to obtain the path to the default browser using native C API’s of the operating systems. For example if it is Firefox it will get back “C:Program Files(x86)Mozilla Firefoxfirefox.exe” on a windows system.
I did some research and this is what I got so far but it’s not the best, in that for linux it only supports gtk systems. I’m not 100% confident its the best method to take either. I also think I’m missing methods for other systems such as
*BSD. Can you please advise:
case 'WINNT': // copy this http://en.code-bude.net/2013/04/28/how-to-retrieve-default-browsers-path-in-c/ // that works properly based on this article: https://newoldthing.wordpress.com/2007/03/23/how-does-your-browsers-know-that-its-not-the-default-browser/ break; case 'Linux': // GDK // https://developer.gnome.org/gio/stable/GAppInfo.html#g-app-info-get-default-for-uri-scheme // non-GDK // ??? break; case 'Darwin': // http://stackoverflow.com/questions/15404723/how-to-get-version-of-default-browser-on-my-mac-os-x/15406479#15406479 break;