isWindowsReservedName
Checks whether a name is one of the MS-DOS device names Windows refuses.
Two steps the caller would otherwise have to know about happen here: trailing dots and spaces are trimmed BEFORE the test, because Windows strips them before deciding and CON is therefore as reserved as CON; and the extension is dropped, because CON.md is reserved too.
CONIN$ / CONOUT$ and the superscript COM² forms are deliberately NOT reserved: they are accepted by every Windows version that runs Obsidian, and matching them would rename files that work.
Answers for Windows regardless of the platform in use: a vault is synced, so the rules that matter are not necessarily those of the machine asking.
Import:
import { isWindowsReservedName } from 'obsidian-dev-utils/obsidian/validation';Signature:
function isWindowsReservedName(name: string): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
name | string | The name to check. A single path segment, with or without its extension. |
Returns: boolean — true if the name is reserved, false otherwise.
Links to this page: