mirror of
https://github.com/godotengine/godot-vscode-plugin.git
synced 2026-01-04 10:09:58 +03:00
Fix scene_file config; fix launch failure
- scene_file used an unnecessary call to path.relative that prevented proper use. Fixes #176 - If the debugger failed to launch, it would fail on future attempts.
This commit is contained in:
@@ -95,6 +95,26 @@ export class ServerController {
|
||||
) {
|
||||
this.debug_data = debug_data;
|
||||
|
||||
if (launch_instance) {
|
||||
let godot_path: string = utils.get_configuration("editor_path", "godot");
|
||||
let executable_line = `"${godot_path}" --path "${project_path}" --remote-debug ${address}:${port}`;
|
||||
if (launch_scene) {
|
||||
let filename = "";
|
||||
if (scene_file) {
|
||||
filename = scene_file;
|
||||
} else {
|
||||
filename = window.activeTextEditor.document.fileName;
|
||||
}
|
||||
executable_line += ` "${filename}"`;
|
||||
}
|
||||
executable_line += this.breakpoint_string(
|
||||
debug_data.get_all_breakpoints(),
|
||||
project_path
|
||||
);
|
||||
let godot_exec = cp.exec(executable_line);
|
||||
this.godot_pid = godot_exec.pid;
|
||||
}
|
||||
|
||||
this.server = net.createServer((socket) => {
|
||||
this.socket = socket;
|
||||
|
||||
@@ -137,32 +157,6 @@ export class ServerController {
|
||||
});
|
||||
|
||||
this.server.listen(port, address);
|
||||
|
||||
if (launch_instance) {
|
||||
let godot_path: string = utils.get_configuration("editor_path", "godot");
|
||||
let executable_line = `"${godot_path}" --path "${project_path}" --remote-debug ${address}:${port}`;
|
||||
if (launch_scene) {
|
||||
let filename = "";
|
||||
if (scene_file) {
|
||||
filename = scene_file;
|
||||
} else {
|
||||
filename = window.activeTextEditor.document.fileName;
|
||||
}
|
||||
if (path.extname(filename).toLowerCase() === ".tscn") {
|
||||
executable_line += ` ${path.relative(project_path, filename)}`;
|
||||
} else {
|
||||
window.showErrorMessage("Active file is not a TSCN file.");
|
||||
Mediator.notify("stop");
|
||||
return;
|
||||
}
|
||||
}
|
||||
executable_line += this.breakpoint_string(
|
||||
debug_data.get_all_breakpoints(),
|
||||
project_path
|
||||
);
|
||||
let godot_exec = cp.exec(executable_line);
|
||||
this.godot_pid = godot_exec.pid;
|
||||
}
|
||||
}
|
||||
|
||||
public step() {
|
||||
@@ -179,6 +173,7 @@ export class ServerController {
|
||||
this.server.close();
|
||||
this.server = undefined;
|
||||
});
|
||||
|
||||
if (this.godot_pid) {
|
||||
TERMINATE(this.godot_pid, (error: string | undefined) => {
|
||||
if (error) {
|
||||
|
||||
Reference in New Issue
Block a user