Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Updated to handle case where local path and remote paths have differe…
Browse files Browse the repository at this point in the history
…nt path separators.
  • Loading branch information
Raul Giacoman committed Mar 22, 2016
1 parent 448f04f commit 3eb98bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ class GoDebugSession extends DebugSession {
private delve: Delve;
private initialBreakpointsSetPromise: Promise<void>;
private signalInitialBreakpointsSet: () => void;
private localPathSeparator: string;
private remotePathSeparator: string;

public constructor(debuggerLinesStartAt1: boolean, isServer: boolean = false) {
super(debuggerLinesStartAt1, isServer);
Expand Down Expand Up @@ -312,6 +314,8 @@ class GoDebugSession extends DebugSession {
let host = args.host || '127.0.0.1';

if (remotePath.length > 0) {
this.localPathSeparator = args.program.includes('/') ? '/' : '\\';
this.remotePathSeparator = remotePath.includes('/') ? '/' : '\\';
if ((remotePath.endsWith('\\')) || (remotePath.endsWith('/'))) {
remotePath = remotePath.substring(0, remotePath.length - 1);
}
Expand Down Expand Up @@ -358,13 +362,13 @@ class GoDebugSession extends DebugSession {
protected toDebuggerPath(path): string {
if (this.delve.remotePath.length === 0)
return this.convertClientPathToDebugger(path);
return path.replace(this.delve.program, this.delve.remotePath);
return path.replace(this.delve.program, this.delve.remotePath).split(this.localPathSeparator).join(this.remotePathSeparator);
}

protected toLocalPath(path): string {
if (this.delve.remotePath.length === 0)
return this.convertDebuggerPathToClient(path);
return path.replace(this.delve.remotePath, this.delve.program);
return path.replace(this.delve.remotePath, this.delve.program).split(this.remotePathSeparator).join(this.localPathSeparator);
}

protected setBreakPointsRequest(response: DebugProtocol.SetBreakpointsResponse, args: DebugProtocol.SetBreakpointsArguments): void {
Expand Down

0 comments on commit 3eb98bb

Please sign in to comment.