@@ -17,21 +17,21 @@ interface IPendingBreakpoint {
17
17
* Converts a local path from Code to a path on the target.
18
18
*/
19
19
export class PathTransformer implements DebugProtocol . IDebugTransformer {
20
- private _webRoot : string ;
20
+ private _appRoot : string ;
21
21
private _platform : string ;
22
22
private _clientPathToWebkitUrl = new Map < string , string > ( ) ;
23
23
private _webkitUrlToClientPath = new Map < string , string > ( ) ;
24
24
private _pendingBreakpointsByPath = new Map < string , IPendingBreakpoint > ( ) ;
25
25
private inferedDeviceRoot :string = null ;
26
26
27
27
public launch ( args : DebugProtocol . ILaunchRequestArgs ) : void {
28
- this . _webRoot = utils . getAppRoot ( args ) ;
28
+ this . _appRoot = args . appRoot ;
29
29
this . _platform = args . platform ;
30
30
this . inferedDeviceRoot = ( this . _platform === 'ios' ) ? 'file://' : this . inferedDeviceRoot ;
31
31
}
32
32
33
33
public attach ( args : DebugProtocol . IAttachRequestArgs ) : void {
34
- this . _webRoot = utils . getAppRoot ( args ) ;
34
+ this . _appRoot = args . appRoot ;
35
35
this . _platform = args . platform ;
36
36
}
37
37
@@ -56,7 +56,7 @@ export class PathTransformer implements DebugProtocol.IDebugTransformer {
56
56
resolve ( ) ;
57
57
}
58
58
else if ( this . inferedDeviceRoot ) {
59
- let inferedUrl = url . replace ( this . _webRoot , this . inferedDeviceRoot ) . replace ( / \\ / g, "/" ) ;
59
+ let inferedUrl = url . replace ( this . _appRoot , this . inferedDeviceRoot ) . replace ( / \\ / g, "/" ) ;
60
60
61
61
//change device path if {N} core module or {N} module
62
62
if ( inferedUrl . indexOf ( "/node_modules/tns-core-modules/" ) != - 1 )
@@ -96,7 +96,7 @@ export class PathTransformer implements DebugProtocol.IDebugTransformer {
96
96
const webkitUrl : string = event . body . scriptUrl ;
97
97
if ( ! this . inferedDeviceRoot && this . _platform === "android" )
98
98
{
99
- this . inferedDeviceRoot = utils . inferDeviceRoot ( this . _webRoot , this . _platform , webkitUrl ) ;
99
+ this . inferedDeviceRoot = utils . inferDeviceRoot ( this . _appRoot , this . _platform , webkitUrl ) ;
100
100
Logger . log ( "\n\n\n ***Inferred device root: " + this . inferedDeviceRoot + "\n\n\n" ) ;
101
101
102
102
if ( this . inferedDeviceRoot . indexOf ( "/data/user/0/" ) != - 1 )
@@ -105,12 +105,12 @@ export class PathTransformer implements DebugProtocol.IDebugTransformer {
105
105
}
106
106
}
107
107
108
- const clientPath = utils . webkitUrlToClientPath ( this . _webRoot , this . _platform , webkitUrl ) ;
108
+ const clientPath = utils . webkitUrlToClientPath ( this . _appRoot , this . _platform , webkitUrl ) ;
109
109
110
110
if ( ! clientPath ) {
111
- Logger . log ( `Paths.scriptParsed: could not resolve ${ webkitUrl } to a file in the workspace. webRoot: ${ this . _webRoot } ` ) ;
111
+ Logger . log ( `Paths.scriptParsed: could not resolve ${ webkitUrl } to a file in the workspace. webRoot: ${ this . _appRoot } ` ) ;
112
112
} else {
113
- Logger . log ( `Paths.scriptParsed: resolved ${ webkitUrl } to ${ clientPath } . webRoot: ${ this . _webRoot } ` ) ;
113
+ Logger . log ( `Paths.scriptParsed: resolved ${ webkitUrl } to ${ clientPath } . webRoot: ${ this . _appRoot } ` ) ;
114
114
this . _clientPathToWebkitUrl . set ( clientPath , webkitUrl ) ;
115
115
this . _webkitUrlToClientPath . set ( webkitUrl , clientPath ) ;
116
116
@@ -132,7 +132,7 @@ export class PathTransformer implements DebugProtocol.IDebugTransformer {
132
132
if ( frame . source && frame . source . path ) {
133
133
const clientPath = this . _webkitUrlToClientPath . has ( frame . source . path ) ?
134
134
this . _webkitUrlToClientPath . get ( frame . source . path ) :
135
- utils . webkitUrlToClientPath ( this . _webRoot , this . _platform , frame . source . path ) ;
135
+ utils . webkitUrlToClientPath ( this . _appRoot , this . _platform , frame . source . path ) ;
136
136
// Incoming stackFrames have sourceReference and path set. If the path was resolved to a file in the workspace,
137
137
// clear the sourceReference since it's not needed.
138
138
if ( clientPath ) {
0 commit comments