Skip to content

Commit 284e5dc

Browse files
committed
fixes #252
1 parent d7078e5 commit 284e5dc

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/client/debugger/Main.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ export class PythonDebugger extends DebugSession {
146146
this.pythonProcess.SendResumeThread(pyThread.Id);
147147
});
148148
}
149+
else if (this.attachArgs) {
150+
this.sendEvent(new StoppedEvent("entry", pyThread.Id));
151+
}
149152
else {
150153
this.pythonProcess.SendResumeThread(pyThread.Id);
151154
}
@@ -351,8 +354,15 @@ export class PythonDebugger extends DebugSession {
351354
/** converts the remote path to local path */
352355
protected convertDebuggerPathToClient(remotePath: string): string {
353356
if (this.attachArgs && this.attachArgs.localRoot && this.attachArgs.remoteRoot) {
354-
// get the part of the path that is relative to the source root
355-
const pathRelativeToSourceRoot = path.relative(this.attachArgs.remoteRoot, remotePath);
357+
let pathRelativeToSourceRoot = '';
358+
// It is possible we're dealing with cross platform debugging
359+
// If so, then path.relative won't work :(
360+
if (remotePath.toUpperCase().startsWith(this.attachArgs.remoteRoot.toUpperCase())){
361+
pathRelativeToSourceRoot = remotePath.substring(this.attachArgs.remoteRoot.length);
362+
} else {
363+
// get the part of the path that is relative to the source root
364+
pathRelativeToSourceRoot = path.relative(this.attachArgs.remoteRoot, remotePath);
365+
}
356366
// resolve from the local source root
357367
return path.resolve(this.attachArgs.localRoot, pathRelativeToSourceRoot);
358368
} else {
@@ -366,6 +376,7 @@ export class PythonDebugger extends DebugSession {
366376
const pathRelativeToClientRoot = path.relative(this.attachArgs.localRoot, clientPath);
367377
// resolve from the remote source root
368378
return path.resolve(this.attachArgs.remoteRoot, pathRelativeToClientRoot);
379+
// return pathRelativeToClientRoot;
369380
} else {
370381
return clientPath;
371382
}

0 commit comments

Comments
 (0)