Skip to content

components/rmdir-guard-component

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

Class Description
RmdirGuardComponent Makes 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.
Variable Description
NOT_EMPTY_DIRECTORY_ERROR_CODE The 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.