Skip to content

hasOwnAttachmentFolder

Checks whether a note’s attachment folder is specific to that note rather than shared with its siblings.

The answer is derived by comparing the note’s attachment folder with the one a same-folder sibling note would get: they differ only when the folder depends on the note’s NAME. Every built-in attachmentFolderPath mode — the vault root, a fixed folder, the note’s own folder (./), a subfolder of the note’s folder (./sub) — is shared by every note in that folder, so it answers false; true arises from a GetAvailablePathForAttachmentsFunctionExtended.extended override that derives the folder from the note’s name (what an attachment-location plugin produces).

This is the distinction a caller needs before sweeping an attachment folder wholesale: only a note-specific folder can be treated as belonging to the note.

Import:

import { hasOwnAttachmentFolder } from 'obsidian-dev-utils/obsidian/attachment-path';

Signature:

function hasOwnAttachmentFolder(params: HasOwnAttachmentFolderParams): Promise<boolean>

Parameters:

ParameterTypeDescription
paramsHasOwnAttachmentFolderParamsParameters for the has own attachment folder function.

Returns: Promise<boolean> — A Promise that resolves to a boolean indicating whether the note has its own attachment folder.


Links to this page: