2

I am writing a paper and I need to confirm something that is pretty obvious to me but I haven't seen the code that would authoritatively tell me that this is how it works.

When I open a folder in Nautilus, does it call stat syscall and file command on every regular file in that folder? I also wonder how it generates thumbnails but that is a side quest.

Zanna
  • 72,312
ArekBulski
  • 1,201

1 Answers1

0

Nautilus is written in C. I have not found any reference to stat syscall in the source code, so cannot say with 100% certainty that it does or does not use it.

Mime type of files is obtained via nautilus_file_get_mime_type function, which is referenced a lot in multiple files such as nautilus-mime-actions.c , nautilus-properties-window.c , nautilus-window-slots.c and others.

However, i could not find the definition of that function, only assignments:

$ grep -iR 'file_get_mime_type'                                                                                          
nautilus-canvas-view-container.c:   mime_type = nautilus_file_get_mime_type (file);
nautilus-mime-actions.c:    mime_type = nautilus_file_get_mime_type (file);
nautilus-mime-actions.c:    mime_type_a = nautilus_file_get_mime_type (file_a);
nautilus-mime-actions.c:    mime_type_b = nautilus_file_get_mime_type (file_b);
nautilus-mime-actions.c:    mime_type = nautilus_file_get_mime_type (file);
nautilus-mime-actions.c:    char *mime_type = nautilus_file_get_mime_type (parameters->file);
nautilus-mime-actions.c:        mime_type = nautilus_file_get_mime_type (parameters_install->file);
nautilus-mime-actions.c:    mime_type = nautilus_file_get_mime_type (parameters_install->file);
nautilus-mime-actions.c:    mime_type = nautilus_file_get_mime_type (file);
nautilus-properties-window.c:       ret = g_list_append (ret, nautilus_file_get_mime_type (NAUTILUS_FILE (l->data)));
nautilus-properties-window.c:   mime_type = nautilus_file_get_mime_type (file);
nautilus-properties-window.c:   mime_type = nautilus_file_get_mime_type (target_file);
nautilus-window-slot.c:     mimetype = nautilus_file_get_mime_type (file);