Path.isReservedDeviceName

bool isReservedDeviceName() const

Detect whether this path's final component is a reserved Windows device name.

Platform semantics:

  • Windows: Returns true for names like CON, PRN, AUX, NUL,

COM1..COM9, LPT1..LPT9, even when followed by an extension (e.g., CON.txt). Also returns true for device namespace forms like \\.\\NUL and \\?\\NUL.

  • Other platforms: Always returns false.

Notes:

  • This check is purely syntactic; it does not consult the filesystem.
  • Trailing dots and spaces are ignored as Windows normalizes them away.