From b137578e661c9d06eaa482293aad614a586a0acb Mon Sep 17 00:00:00 2001 From: Robin Date: Sun, 22 Oct 2023 09:33:04 -0500 Subject: [PATCH] pdc executes from workspace root fixes #35 --- src/core/ConfigurationResolver.ts | 2 ++ src/pdc/PDCExecutionFactory.ts | 2 ++ src/pdc/PDCTaskRunner.ts | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/ConfigurationResolver.ts b/src/core/ConfigurationResolver.ts index 794750e..4912854 100644 --- a/src/core/ConfigurationResolver.ts +++ b/src/core/ConfigurationResolver.ts @@ -11,6 +11,7 @@ import { readSDKPath } from "./readSDKPath"; import { readSDKVersion } from "./readSDKVersion"; export interface Configuration { + workspaceRoot: string; sdkPath: string; sdkVersion: string; sourcePath: string; @@ -88,6 +89,7 @@ export class ConfigurationResolver { const gamePath = productPath + ".pdx"; return { + workspaceRoot, sdkPath, sdkVersion, sourcePath, diff --git a/src/pdc/PDCExecutionFactory.ts b/src/pdc/PDCExecutionFactory.ts index 7925047..e31172f 100644 --- a/src/pdc/PDCExecutionFactory.ts +++ b/src/pdc/PDCExecutionFactory.ts @@ -31,6 +31,7 @@ export class PDCExecutionFactory implements TaskExecutionFactory { } const { + workspaceRoot, sdkPath: sdkPathConfig, sourcePath: sourcePathConfig, gamePath: gamePathConfig, @@ -55,6 +56,7 @@ export class PDCExecutionFactory implements TaskExecutionFactory { const execution = new vscode.CustomExecution(async () => { const runner = new PDCTaskRunner({ + workspaceRoot, sdkPath, sourcePath, gamePath, diff --git a/src/pdc/PDCTaskRunner.ts b/src/pdc/PDCTaskRunner.ts index 4e4ed6a..6d9f1ff 100644 --- a/src/pdc/PDCTaskRunner.ts +++ b/src/pdc/PDCTaskRunner.ts @@ -14,6 +14,7 @@ import { getPDCCommand, GetPDCCommandOptions } from "./getPDCCommand"; * `tasks.json`. */ export interface PDCTaskRunnerOptions { + workspaceRoot: string; sdkPath: string; sourcePath: string; gamePath: string; @@ -34,6 +35,7 @@ export class PDCTaskRunner implements TaskRunner { constructor(private options: PDCTaskRunnerOptions) {} async run(onMessage: OnTaskRunnerMessage): Promise { + const { workspaceRoot } = this.options; const pdcOptions = this.getPDCOptions(); const pdcCommand = getPDCCommand(pdcOptions); @@ -50,7 +52,7 @@ export class PDCTaskRunner implements TaskRunner { onMessage("Compiling..."); onMessage(`> ${pdcCommand}`); - await exec(pdcCommand); + await exec(pdcCommand, { cwd: workspaceRoot }); } private getPDCOptions(): GetPDCCommandOptions {