diff options
Diffstat (limited to 'extension/src/diffs.ts')
-rw-r--r-- | extension/src/diffs.ts | 8 |
1 files changed, 7 insertions, 1 deletions
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<string, DiffInfo> = 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, |