From 68831f3d0af34a6f83b120ade86a1aa69a7017ac Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 5 Jul 2023 12:09:10 -0700 Subject: explain by default --- extension/src/diffs.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'extension/src') diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts index 19ec80ab..b70c3b59 100644 --- a/extension/src/diffs.ts +++ b/extension/src/diffs.ts @@ -16,7 +16,7 @@ class DiffManager { // Doing this because virtual files are read-only private diffs: Map = new Map(); - constructor() { + private setupDirectory() { // Make sure the diff directory exists if (!fs.existsSync(DIFF_DIRECTORY)) { fs.mkdirSync(DIFF_DIRECTORY, { @@ -25,6 +25,10 @@ class DiffManager { } } + constructor() { + this.setupDirectory(); + } + private escapeFilepath(filepath: string): string { return filepath.replace(/\\/g, "_").replace(/\//g, "_"); } @@ -47,6 +51,8 @@ class DiffManager { } writeDiff(originalFilepath: string, newContent: string): string { + this.setupDirectory(); + // Create or update existing diff const newFilepath = path.join( DIFF_DIRECTORY, -- cgit v1.2.3-70-g09d2