Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion src/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ export function convertDebuggerPathToClient(
let localPath: string
if (serverSourceRoot && localSourceRoot) {
// get the part of the path that is relative to the source root
const pathRelativeToSourceRoot = (serverIsWindows ? path.win32 : path.posix).relative(
let pathRelativeToSourceRoot = (serverIsWindows ? path.win32 : path.posix).relative(
Comment thread
robberphex marked this conversation as resolved.
serverSourceRoot,
serverPath
)
if (serverIsWindows) {
pathRelativeToSourceRoot = pathRelativeToSourceRoot.replace(/\\/g, path.sep)
}
// resolve from the local source root
localPath = path.resolve(localSourceRoot, pathRelativeToSourceRoot)
} else {
Expand Down
8 changes: 8 additions & 0 deletions src/test/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ describe('paths', () => {
}),
'/home/felix/mysource/source.php'
)
// multi level source
assert.equal(
convertDebuggerPathToClient('file:///C:/Program%20Files/MySource/src/app/source.php', {
'C:\\Program Files\\Apache\\2.4\\htdocs': '/home/felix/mysite',
'C:\\Program Files\\MySource': '/home/felix/mysource',
}),
'/home/felix/mysource/src/app/source.php'
)
})
// windows to windows
;(process.platform === 'win32' ? it : it.skip)('should map windows uris to windows paths', () => {
Expand Down