/* * Build: * gcc $(pkg-config --cflags gtk+-3.0) sample.c -o sample $(pkg-config --libs gtk+-3.0) */ #include void check(const char *path) { GFile *file = g_file_new_for_path (path); GFileInfo *filesystem_info = g_file_query_filesystem_info (file, "filesystem::*", NULL, NULL); gboolean isReadOnly = g_file_info_get_attribute_boolean (filesystem_info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY); g_print ("is %s read only? %s\n", path, isReadOnly ? "TRUE" : "FALSE"); g_object_unref (filesystem_info); g_object_unref (file); } int main (int argc, char *argv[]) { gtk_init (&argc, &argv); check ("/mount1/name/content"); check ("/mount1/name"); check ("/mount1/name/Desktop"); return 0; }