(fileName: string, content: string, exportPath: string)
| 5 | constructor(private app: App) {} |
| 6 | |
| 7 | async createMarkdownFile(fileName: string, content: string, exportPath: string): Promise<TFile> { |
| 8 | const fullPath = await this.getExportPath(fileName, exportPath); |
| 9 | |
| 10 | try { |
| 11 | return await this.app.vault.create(`${fullPath}.md`, content); |
| 12 | } catch (error) { |
| 13 | if (error.message && error.message.includes("already exists")) { |
| 14 | throw new Error(t("Export file already exists. Please try again in a moment.")); |
| 15 | } |
| 16 | |
| 17 | throw new Error(t("Failed to create export file: ") + error.message); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | private async getExportPath(fileName: string, exportPath: string): Promise<string> { |
| 22 | if (!exportPath) { |
no test coverage detected