Skip to content

feat: display symlink, junction, and hardlink targets in directory listings #6

@relmer

Description

@relmer

Summary

Display the target path for junctions, symlinks, and hardlinks in all display modes (normal, wide, bare, tree). Currently, reparse points are detected in tree mode and shown as [→ target], but this should be extended to all modes.

Details

Junctions & Symlinks

  • Show → target_path after the filename in normal/tree modes
  • Use DeviceIoControl with FSCTL_GET_REPARSE_POINT to resolve targets (already partially implemented for tree mode reparse guard)
  • Distinguish junction vs symlink via reparse tag (IO_REPARSE_TAG_MOUNT_POINT vs IO_REPARSE_TAG_SYMLINK)

Hardlinks

  • Show hardlink count when > 1 (e.g., [2 links])
  • Use GetFileInformationByHandle for nNumberOfLinks
  • Optionally: FindFirstFileNameW/FindNextFileNameW to enumerate all paths

Scope

  • Extend to all display modes: normal, wide, bare, tree
  • Add configurable color for link target text (new Attribute variant)
  • Consider a /Links switch to opt-in to hardlink enumeration (performance: requires opening each file)

Prior Art

  • eza and lsd both display symlink targets inline
  • Current TCDir tree mode already detects reparse points (FILE_ATTRIBUTE_REPARSE_POINT) and prevents cycle traversal

Notes

  • This feature should be implemented in TCDir first, then ported to RCDir per the standard workflow

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions