findAttachmentUnitFolderPath
Finds the folder that an attachment must travel with.
Returns the outermost designated ancestor, not the nearest one. With nested designations, moving the nearest would tear the outer tree in half, which is the failure the whole feature exists to prevent.
The vault root is never a unit, however the patterns are written: designating it would make every relocation a no-op at best and a vault-wide move at worst.
Passing an App walks with the designation an attachment-location plugin published on the vault; when nobody published one, nothing is designated and the answer is null.
Import:
import { findAttachmentUnitFolderPath } from 'obsidian-dev-utils/obsidian/attachment-unit-folder';Signature:
function findAttachmentUnitFolderPath(params: FindAttachmentUnitFolderPathParams): string | nullParameters:
| Parameter | Type | Description |
|---|---|---|
params | FindAttachmentUnitFolderPathParams | The parameters for finding the attachment unit folder. |
Returns: string | null — The unit folder’s path, or null when the attachment belongs to no unit.
Links to this page: