Skip to content

Commit 1526733

Browse files
committed
fix SSH file resolution fix #173
1 parent 7b4a682 commit 1526733

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/mibase.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,9 @@ export class MI2DebugSession extends DebugSession {
230230
this.miDebugger.clearBreakPoints().then(() => {
231231
let path = args.source.path;
232232
if (this.isSSH) {
233-
path = relative(this.trimCWD.replace(/\\/g, "/"), path.replace(/\\/g, "/"));
234-
path = systemPath.resolve(this.switchCWD.replace(/\\/g, "/"), path.replace(/\\/g, "/"));
233+
// trimCWD is the local path, switchCWD is the ssh path
234+
path = systemPath.relative(this.trimCWD.replace(/\\/g, "/"), path.replace(/\\/g, "/"));
235+
path = resolve(this.switchCWD.replace(/\\/g, "/"), path.replace(/\\/g, "/"));
235236
}
236237
const all = args.breakpoints.map(brk => {
237238
return this.miDebugger.addBreakPoint({ file: path, line: brk.line, condition: brk.condition, countCondition: brk.hitCondition });
@@ -302,6 +303,7 @@ export class MI2DebugSession extends DebugSession {
302303
let file = element.file;
303304
if (file) {
304305
if (this.isSSH) {
306+
// trimCWD is the local path, switchCWD is the ssh path
305307
file = relative(this.switchCWD.replace(/\\/g, "/"), file.replace(/\\/g, "/"));
306308
file = systemPath.resolve(this.trimCWD.replace(/\\/g, "/"), file.replace(/\\/g, "/"));
307309
} else if (process.platform === "win32") {

0 commit comments

Comments
 (0)