Skip to content

CaseInsensitiveFileIndex.rename method

CaseInsensitiveFileIndex › rename

Re-keys an abstract file (and, for folders, all of its descendants) after a rename.

Obsidian fires a single rename event for the renamed abstract file and updates its descendants' paths in place without firing per-descendant events, so descendant keys are recomputed here by swapping the old path prefix for the new one. Handles case-only renames (the old and new keys coincide).

Signature:

rename(oldPath: string, newAbstractFile: TAbstractFile): void

Parameters:

ParameterTypeDescription
oldPathstringThe path the abstract file had before the rename.
newAbstractFileTAbstractFileThe abstract file with its updated (post-rename) path.

Returns: void