@@ -8,18 +8,9 @@ import * as url from 'url';
88import * as childProcess from 'child_process' ;
99import * as path from 'path' ;
1010import * as util from 'util' ;
11+ import fileUrl = require( 'file-url' ) ;
1112import { Terminal } from './terminal' ;
1213
13- /** converts a path to a file URI */
14- function fileUrl ( path : string ) : string {
15- let pathName = path . replace ( / \\ / g, '/' ) ;
16- // Windows drive letter must be prefixed with a slash
17- if ( pathName [ 0 ] !== '/' ) {
18- pathName = '/' + pathName ;
19- }
20- return encodeURI ( 'file://' + pathName ) ;
21- }
22-
2314/** formats a xdebug property value for VS Code */
2415function formatPropertyValue ( property : xdebug . BaseProperty ) : string {
2516 let displayValue : string ;
@@ -260,14 +251,14 @@ class PhpDebugSession extends vscode.DebugSession {
260251
261252 /** converts a local path from VS Code to a server-side XDebug file URI with respect to source root settings */
262253 protected convertClientPathToDebugger ( localPath : string ) : string {
263- let localFileUri = fileUrl ( localPath ) ;
254+ let localFileUri = fileUrl ( localPath , { resolve : false } ) ;
264255 let serverFileUri : string ;
265256 if ( this . _args . serverSourceRoot && this . _args . localSourceRoot ) {
266- let localSourceRootUrl = fileUrl ( this . _args . localSourceRoot ) ;
257+ let localSourceRootUrl = fileUrl ( this . _args . localSourceRoot , { resolve : false } ) ;
267258 if ( ! localSourceRootUrl . endsWith ( '/' ) ) {
268259 localSourceRootUrl += '/' ;
269260 }
270- let serverSourceRootUrl = fileUrl ( this . _args . serverSourceRoot ) ;
261+ let serverSourceRootUrl = fileUrl ( this . _args . serverSourceRoot , { resolve : false } ) ;
271262 if ( ! serverSourceRootUrl . endsWith ( '/' ) ) {
272263 serverSourceRootUrl += '/' ;
273264 }
0 commit comments