* Write a file, creating it if it doesn't exist or updating if it does.
(path: string, content: string)
| 140 | * Write a file, creating it if it doesn't exist or updating if it does. |
| 141 | */ |
| 142 | private async writeFile(path: string, content: string): Promise<void> { |
| 143 | const vault = this.plugin.app.vault; |
| 144 | const fileExists = await vault.adapter.exists(path); |
| 145 | |
| 146 | if (fileExists) { |
| 147 | await vault.adapter.write(path, content); |
| 148 | } else { |
| 149 | await vault.create(path, content); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * Build the mdbase.yaml content. |