Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix #252 and #302 after vscode update to 1.5.1 #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 12 additions & 20 deletions src/client/debugger/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,26 +369,14 @@ export class PythonDebugger extends DebugSession {
/** converts the remote path to local path */
protected convertDebuggerPathToClient(remotePath: string): string {
if (this.attachArgs && this.attachArgs.localRoot && this.attachArgs.remoteRoot) {
let pathRelativeToSourceRoot = path.relative(this.attachArgs.remoteRoot, remotePath);
let clientPath = path.resolve(this.attachArgs.localRoot, pathRelativeToSourceRoot);
if (validatePathSync(clientPath)){
return clientPath;
}
else {
// It is possible we're dealing with cross platform debugging
// If so, then path.relative won't work :(
if (remotePath.toUpperCase().startsWith(this.attachArgs.remoteRoot.toUpperCase())) {
pathRelativeToSourceRoot = remotePath.substring(this.attachArgs.remoteRoot.length).trim();
} else {
// get the part of the path that is relative to the source root
pathRelativeToSourceRoot = path.relative(this.attachArgs.remoteRoot, remotePath).trim();
}
if (pathRelativeToSourceRoot.startsWith(path.sep)){
pathRelativeToSourceRoot = pathRelativeToSourceRoot.substring(1);
}
// resolve from the local source root
return path.resolve(this.attachArgs.localRoot, pathRelativeToSourceRoot);
let path2 = path.win32;
if (this.attachArgs.remoteRoot.indexOf('/') != -1) {
path2 = path.posix;
}
let pathRelativeToSourceRoot = path2.relative(this.attachArgs.remoteRoot, remotePath);
// resolve from the local source root
let clientPath = path.resolve(this.attachArgs.localRoot, pathRelativeToSourceRoot);
return clientPath;
} else {
return remotePath;
}
Expand All @@ -399,7 +387,11 @@ export class PythonDebugger extends DebugSession {
// get the part of the path that is relative to the client root
const pathRelativeToClientRoot = path.relative(this.attachArgs.localRoot, clientPath);
// resolve from the remote source root
return path.resolve(this.attachArgs.remoteRoot, pathRelativeToClientRoot);
let path2 = path.win32;
if (this.attachArgs.remoteRoot.indexOf('/') != -1) {
path2 = path.posix;
}
return path2.resolve(this.attachArgs.remoteRoot, pathRelativeToClientRoot);
} else {
return clientPath;
}
Expand Down