Skip to content

findNameCollisions

Finds the names of one folder that cannot coexist: names that differ only in letter case, which a case-insensitive platform keeps one of, and names equal after Unicode NFC normalization.

A case clash is reported once per enabled case-insensitive platform. A Unicode-form clash is reported once with no platform, like PathCompatibilityViolationType.UnicodeNotNormalized, whenever any platform is enabled: Obsidian itself normalizes, so such a pair is a hazard on every platform.

The case fold is Unicode’s simple one-to-one case mapping, per code point and independent of the locale, so ß collides with neither SS nor ẞ, Turkish İ not with i, and ı not with I, all as on NTFS. It over-reports where an NTFS volume’s upcase table predates the Unicode the app runs: letters added since then, and letters outside the Basic Multilingual Plane, collide here but not on such a volume, while APFS folds them.

Import:

import { findNameCollisions } from '@mnaoumov/obsidian-lib/path-compatibility';

Signature:

function findNameCollisions(params: FindNameCollisionsParams): NameCollision[]

Parameters:

Parameter Type Description
params FindNameCollisionsParams The folder’s names and the platforms to check them against.

Returns: NameCollision[] — One entry per group of two or more colliding names, in the order their first names were given.


Links to this page: