Path.sameOpenFile

bool sameOpenFile(int fd1, int fd2) static

Returns true if two open files refer to the same underlying file object.

This is an equivalent of Python's os.path.sameopenfile.

Platform semantics:

  • POSIX: Compares st_dev and st_ino obtained via fstat(2) on both file descriptors.
  • Windows: Best-effort fallback — compares FILE* pointers identity when using the File overload. The fd-based overload returns false as a conservative answer. This limitation is documented; a future task may implement proper identity using Win32 APIs.

    Parameters

    fd1First open file descriptor.
    fd2Second open file descriptor.

    Returns

    true if both refer to the same file object; false otherwise.
bool sameOpenFile(File f1, File f2) static

Returns true if two std.stdio.File handles refer to the same file.

See also: sameOpenFile(int, int).