components/rmdir-guard-component
Contains class RmdirGuardComponent that makes the recursive flag of DataAdapter.rmdir mean what it says.
Obsidian workaround adapter-rmdir-ignores-recursive, seen in Obsidian 1.13.7: its canary is in rmdir-guard-component.obsidian.integration.test.ts.
Classes
Section titled “Classes”| 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. |
Variables
Section titled “Variables”| 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. |