Skip to content

Commit

Permalink
fix: properly read default build target from config
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 committed Nov 11, 2024
1 parent e551da0 commit dccca06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function registerBuildCommands(context: vscode.ExtensionContext) {
let settingsDefaultTarget = buildConfig.get<string>("defaultTarget");
settingsDefaultTarget =
settingsDefaultTarget === blankConfigEnumValue
? ""
? undefined
: settingsDefaultTarget;
let target = settingsDefaultTarget;

Expand Down
8 changes: 4 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as childProcess from "node:child_process";
import * as fs from "node:fs";
import * as os from "node:os";
import * as path from "node:path";
import { promisify } from "node:util";
Expand Down Expand Up @@ -28,7 +27,6 @@ import Logger from "./logging";
import type { ElectronPatchesConfig, EVMConfig } from "./types";

const exec = promisify(childProcess.exec);
const fsReadFile = promisify(fs.readFile);

const remoteFileContentCache = new LRU<string, string>({
max: 500,
Expand Down Expand Up @@ -115,10 +113,12 @@ export async function getConfigDefaultTarget(): Promise<string | undefined> {
encoding: "utf8",
},
);
const configFilename = stdout.trim();
const configFilename = vscode.Uri.file(stdout.trim());

const config: EVMConfig = JSON.parse(
await fsReadFile(configFilename, { encoding: "utf8" }),
await vscode.workspace.fs
.readFile(configFilename)
.then((buffer) => buffer.toString()),
);

return config.defaultTarget;
Expand Down

0 comments on commit dccca06

Please sign in to comment.