Skip to content

Commit

Permalink
pdc executes from workspace root
Browse files Browse the repository at this point in the history
fixes #35
  • Loading branch information
midouest committed Oct 22, 2023
1 parent ddc2420 commit b137578
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/core/ConfigurationResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { readSDKPath } from "./readSDKPath";
import { readSDKVersion } from "./readSDKVersion";

export interface Configuration {
workspaceRoot: string;
sdkPath: string;
sdkVersion: string;
sourcePath: string;
Expand Down Expand Up @@ -88,6 +89,7 @@ export class ConfigurationResolver {
const gamePath = productPath + ".pdx";

return {
workspaceRoot,
sdkPath,
sdkVersion,
sourcePath,
Expand Down
2 changes: 2 additions & 0 deletions src/pdc/PDCExecutionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class PDCExecutionFactory implements TaskExecutionFactory {
}

const {
workspaceRoot,
sdkPath: sdkPathConfig,
sourcePath: sourcePathConfig,
gamePath: gamePathConfig,
Expand All @@ -55,6 +56,7 @@ export class PDCExecutionFactory implements TaskExecutionFactory {

const execution = new vscode.CustomExecution(async () => {
const runner = new PDCTaskRunner({
workspaceRoot,
sdkPath,
sourcePath,
gamePath,
Expand Down
4 changes: 3 additions & 1 deletion src/pdc/PDCTaskRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { getPDCCommand, GetPDCCommandOptions } from "./getPDCCommand";
* `tasks.json`.
*/
export interface PDCTaskRunnerOptions {
workspaceRoot: string;
sdkPath: string;
sourcePath: string;
gamePath: string;
Expand All @@ -34,6 +35,7 @@ export class PDCTaskRunner implements TaskRunner {
constructor(private options: PDCTaskRunnerOptions) {}

async run(onMessage: OnTaskRunnerMessage): Promise<void> {
const { workspaceRoot } = this.options;
const pdcOptions = this.getPDCOptions();
const pdcCommand = getPDCCommand(pdcOptions);

Expand All @@ -50,7 +52,7 @@ export class PDCTaskRunner implements TaskRunner {

onMessage("Compiling...");
onMessage(`> ${pdcCommand}`);
await exec(pdcCommand);
await exec(pdcCommand, { cwd: workspaceRoot });
}

private getPDCOptions(): GetPDCCommandOptions {
Expand Down

0 comments on commit b137578

Please sign in to comment.