Skip to content

Commit d456280

Browse files
committed
More cleanup
1 parent 62fcc0b commit d456280

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

packages/cursorless-engine/src/nodeCommon/TalonSpokenFormsJsonReader.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Disposer, FileSystem, Notifier } from "@cursorless/common";
2-
import { mkdir, readFile } from "fs/promises";
2+
import { readFile } from "fs/promises";
33

44
import * as path from "path";
55
import {
@@ -20,17 +20,10 @@ export class TalonSpokenFormsJsonReader implements TalonSpokenForms {
2020
private notifier = new Notifier();
2121

2222
constructor(private fileSystem: FileSystem) {
23-
this.init();
24-
}
25-
26-
private async init() {
27-
const parentDir = path.dirname(
28-
this.fileSystem.cursorlessTalonStateJsonPath,
29-
);
30-
await mkdir(parentDir, { recursive: true });
3123
this.disposer.push(
32-
this.fileSystem.watchDir(parentDir, () =>
33-
this.notifier.notifyListeners(),
24+
this.fileSystem.watchDir(
25+
path.dirname(this.fileSystem.cursorlessTalonStateJsonPath),
26+
() => this.notifier.notifyListeners(),
3427
),
3528
);
3629
}

packages/cursorless-vscode/src/extension.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import {
4545
} from "./ScopeVisualizerCommandApi";
4646
import { StatusBarItem } from "./StatusBarItem";
4747
import { vscodeApi } from "./vscodeApi";
48+
import { mkdir } from "fs/promises";
4849

4950
/**
5051
* Extension entrypoint called by VSCode on Cursorless startup.
@@ -149,6 +150,7 @@ async function createVscodeIde(context: vscode.ExtensionContext) {
149150
const cursorlessDir = isTesting()
150151
? path.join(os.tmpdir(), crypto.randomBytes(16).toString("hex"))
151152
: path.join(os.homedir(), ".cursorless");
153+
await mkdir(cursorlessDir, { recursive: true });
152154

153155
return { vscodeIDE, hats, fileSystem: new VscodeFileSystem(cursorlessDir) };
154156
}

0 commit comments

Comments
 (0)