How do you get the icon, MIME type, and application associated with a file in the Linux Desktop?

Here is an example of using GLib/GIO to get the information you want. #include <gio/gio.h> #include <stdio.h> int main (int argc, char **argv) { g_thread_init (NULL); g_type_init (); if (argc < 2) return -1; GError *error; GFile *file = g_file_new_for_path (argv[1]); GFileInfo *file_info = g_file_query_info (file, “standard::*”, 0, NULL, &error); const char *content_type = g_file_info_get_content_type … Read more