Skip to content

path-compatibility

Which naming constraints each platform imposes, which of them a given path violates, and how to repair a name so it satisfies every enabled platform at once.

Pure by design — no App, no vault, no I/O — so the whole correctness surface (byte counting, extension preservation, truncation order, profile composition) is unit-testable without an Obsidian instance. The vault pass that consumes it lives in each plugin that reports or repairs path problems.

A vault is synced, so the platform that matters is not necessarily the one running: enabling several platforms composes their constraints by intersection, and a name has to satisfy all of them.

Interface Description
FindPathCompatibilityViolationsParams Parameters for findPathCompatibilityViolations.
PathCompatibilityMeasurement A length a path or name was measured at, and the limit it exceeds.
PathCompatibilityProfile The naming rules of one platform.
PathCompatibilityViolation One thing wrong with one path, and the platform that objects to it.
RepairNameParams Parameters for repairName.
Function Description
findPathCompatibilityViolations Finds everything wrong with a path, across every enabled platform. Read-only: this is what the consistency report renders, and it never proposes a repair.
getCurrentPathCompatibilityPlatform The platform the plugin is running on, or null on a platform with no profile. Used only to seed the settings defaults, so that a fresh install reports on the vault in front of it without the user configuring anything first.
getForbiddenCharacterReplacementValidationMessage Validates the text a forbidden character is replaced with. Every platform’s set is checked, not only the enabled ones: the toggles can change after the replacement is chosen, and a replacement one platform refuses would make the repair of that platform produce a name that is still invalid there.
isUnicodeNormalized Whether a name is in Unicode NFC, the form Obsidian gives every name it creates.
measure Measures a string the way a filesystem does.
repairName Repairs a name so that it satisfies every enabled platform. The order is deliberate: characters are replaced and a reserved name de-reserved BEFORE anything is truncated, because both can change the length, and trailing dots and spaces are trimmed AFTER every cut, because a cut can expose new ones. Truncation only ever shortens the basename — an extension is what tells Obsidian and the OS what the file is, so a truncated one turns a working .png into a broken .pn.
Enum Description
PathCompatibilityPlatform A platform a vault may be synced to, and whose naming rules can therefore be enforced.
PathCompatibilityViolationType What a single path or name is wrong about, on one platform.
Variable Description
PATH_COMPATIBILITY_PLATFORM_LABELS How each platform is named in the settings tab and the consistency report. Not translated: these are product names, and macOS is spelled macOS in every language.
PATH_COMPATIBILITY_PLATFORMS Every platform, in the order the settings tab and the consistency report list them: the ones whose limits actually bind in practice first.