gfile: Expand documentation around file equality

Prompted by
https://discourse.gnome.org/t/help-on-g-file-equal-and-g-file-attribute-id-file/31268/5.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall
2025-09-17 09:31:44 +01:00
parent 86cd3cc097
commit b961111c97
2 changed files with 16 additions and 1 deletions

View File

@@ -783,9 +783,17 @@ g_file_hash (gconstpointer file)
* *
* Checks if the two given #GFiles refer to the same file. * Checks if the two given #GFiles refer to the same file.
* *
* This function can be used with [method@Gio.File.hash] to insert
* [iface@Gio.File]s efficiently in a hash table.
*
* Note that two #GFiles that differ can still refer to the same * Note that two #GFiles that differ can still refer to the same
* file on the filesystem due to various forms of filename * file on the filesystem due to various forms of filename
* aliasing. * aliasing. For local files, this function essentially compares the file paths,
* so two [iface@Gio.File]s which point to different hard or soft links will not
* be considered equal, despite pointing to the same content.
*
* For determining whether two files are hardlinked, see
* [const@Gio.FILE_ATTRIBUTE_ID_FILE].
* *
* This call does no blocking I/O. * This call does no blocking I/O.
* *

View File

@@ -311,6 +311,13 @@ typedef struct _GFileInfoClass GFileInfoClass;
* *
* An example use would be during listing files, to avoid recursive * An example use would be during listing files, to avoid recursive
* directory scanning. * directory scanning.
*
* For local files on Linux, this is a combination of the files device number
* and inode, so is invariant with respect to hard linking. The format used by
* other VFS implementations may vary, and some VFS backends may not set it.
*
* For simply seeing if two [iface@Gio.File] instances refer to the same path
* on disk, see [method@Gio.File.equal].
**/ **/
#define G_FILE_ATTRIBUTE_ID_FILE "id::file" /* string */ #define G_FILE_ATTRIBUTE_ID_FILE "id::file" /* string */