Skip to content

At after_build_success working directory should be project root #15

Description

@bo3b

While setting up the tasks.json to build, I want to use the buildEvent:after_build_success to copy my output files for debugging.

However, the working directory is actually left at the shell default, which is the home directory for VSCode. When I set it as:

	"buildEvent": {
		"after_build_success": [
			"echo %CD%,
			"xcopy /Y * C:\\Users\\bo3bdar\\Documents\\source\\DirectX-SDK-Samples\\C++\\Direct3D\\ShadowMap\\Debug\\"
		]
	}

It prints out the path as:

C:\Users\bo3bdar\AppData\Local\Programs\Microsoft VS Code

This is a minor problem, because I can always hard code the paths, but it would be nice-to-have if I could use relative paths.


I don't understand enough to fix this, but this sequence is the part that needs to either resolve path vars, or set working directory to the terminal.

		if(taskDefinition.buildEvent.after_build_failure || taskDefinition.buildEvent.after_build_success){
			let commands_failure=taskDefinition.buildEvent.after_build_failure;
			let commands_success=taskDefinition.buildEvent.after_build_success;
			terminal.event_after_build=(success)=>{
				if(success && commands_success){
					for (const cmd of commands_success) {
						let result=ChildProcess.execSync(cmd);
						terminal.emit(result.toString())
					}
				}else if(commands_failure)
					for (const cmd of commands_failure) {
						let result=ChildProcess.execSync(cmd);
						terminal.emit(result.toString())
					}
				
				}
				
		}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions