Skip to content

getCheckIsAttachmentUnitFolderFunction

Reads the attachment-unit-folder designation Custom Attachment Location publishes through its plugin API.

The designation is one plugin’s setting but every relocating plugin’s business, so it is read from the same API that answers the attachment path itself. Reading it here rather than having each caller look for the plugin is the point — a folder kept whole by one plugin and torn apart by another is exactly the failure findAttachmentUnitFolderPath exists to prevent.

undefined means nobody published a designation, the same “nobody owns this policy” answer that sends getAttachmentFilePath to Obsidian’s own resolution. It is distinct from a designation that answers false for every folder.

The registry is looked up once, when this is called, so a caller walking a folder’s ancestors asks the same API all the way up.

Import:

import { getCheckIsAttachmentUnitFolderFunction } from '@mnaoumov/obsidian-lib/attachment-path';

Signature:

function getCheckIsAttachmentUnitFolderFunction(_app: App): ((folderPath: string) => boolean) | undefined

Parameters:

Parameter Type Description
_app App An Obsidian application instance. Unused since the answer comes from the plugin API registry; kept so existing callers compile unchanged.

Returns: ((folderPath: string) => boolean) | undefined — The designation predicate, or undefined when nobody published one.