Skip to content

obsidian/components/rmdir-guard-component

Contains class RmdirGuardComponent that makes the recursive flag of DataAdapter.rmdir mean what it says.

ClassDescription
RmdirGuardComponentMakes app.vault.adapter.rmdir(path, false) behave as its name promises: a non-recursive call on a folder that still has children throws instead of deleting them.
VariableDescription
NOT_EMPTY_DIRECTORY_ERROR_CODEThe code carried by the error thrown when a non-recursive rmdir is refused because the folder has children. Matches the POSIX/Node error code a correct non-recursive directory removal produces, so a caller already branching on error.code keeps working. Check the code, never instanceof — every plugin bundles its own copy of this library, so the error may cross a copy boundary.