Nautilus 在所有目录条目上调用 stat/file

Nautilus 在所有目录条目上调用 stat/file

我正在写一篇论文,我需要确认一些对我来说非常明显的事情,但我还没有看到可以权威地告诉我它是如何工作的代码。

当我在 Nautilus 中打开一个文件夹时,它是否会对该文件夹中的每个常规文件调用statsyscall 和file命令?我还想知道它如何生成缩略图,但这只是一个附带任务。

答案1

Nautilus 是用 C 编写的。我没有stat在源代码中找到对 syscall 的任何引用,因此不能 100% 肯定地说它是否使用 syscall。

文件的 Mime 类型是通过函数获取的,该函数在、等nautilus_file_get_mime_type多个文件中被大量引用。nautilus-mime-actions.cnautilus-properties-window.cnautilus-window-slots.c

但是,我找不到该函数的定义,只有赋值:

$ 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);

相关内容