From a9bf770f26d3d28af322ad086075fe2bda1efe39 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Sun, 20 Aug 2023 11:11:16 +0200 Subject: [PATCH] #621 - Create data file if it does not exist yet --- CHANGELOG.md | 1 + src/listeners/dashboard/DataListener.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 913892f4..4cd674d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ - [#603](https://github.com/estruyf/vscode-front-matter/issues/603): Fix problem with page bundles and path placeholders - [#617](https://github.com/estruyf/vscode-front-matter/issues/617): Fix insert media snippet dialog by using a slideover instead of a dialog - [#620](https://github.com/estruyf/vscode-front-matter/issues/620): Fix in array field of data files +- [#621](https://github.com/estruyf/vscode-front-matter/issues/621): Create data file if it does not exist yet ## [8.4.0] - 2023-04-03 - [Release notes](https://beta.frontmatter.codes/updates/v8.4.0) diff --git a/src/listeners/dashboard/DataListener.ts b/src/listeners/dashboard/DataListener.ts index 3fd28130..0416c911 100644 --- a/src/listeners/dashboard/DataListener.ts +++ b/src/listeners/dashboard/DataListener.ts @@ -48,6 +48,8 @@ export class DataListener extends BaseListener { if (!(await existsAsync(dirPath))) { await mkdirAsync(dirPath, { recursive: true }); } + + await writeFileAsync(absPath, '', 'utf8'); } const fileContent = await readFileAsync(absPath, 'utf8');