Skip to content

isResourceLockedForPathByAncestor

Checks whether the note at the given path is currently locked directly OR is covered by a subtree-locked ancestor folder.

Unlike isResourceLockedForPath, which only reports an exact-path lock, this also reports a path that lies under a folder locked in subtree mode. Use it to detect that a rename/move is happening inside a foreign plugin’s in-flight locked transaction (which locks the affected folder subtree), so that a bystander (e.g. the rename/delete handler) can stay out of the way and let the transaction’s owner keep its own links consistent.

Import:

import { isResourceLockedForPathByAncestor } from '@mnaoumov/obsidian-lib/resource-lock';

Signature:

function isResourceLockedForPathByAncestor(app: App, pathOrFile: PathOrFile): boolean

Parameters:

Parameter Type Description
app App The Obsidian app instance.
pathOrFile PathOrFile The path or file of the note to check.

Returns: boolean — true if the path is itself locked or lies under a subtree-locked ancestor folder.