@@ -27,6 +27,7 @@ export class PathTransformer implements IDebugTransformer {
2727 public launch ( args : ILaunchRequestArgs ) : void {
2828 this . _webRoot = utils . getAppRoot ( args ) ;
2929 this . _platform = args . platform ;
30+ this . inferedDeviceRoot = ( this . _platform === 'ios' ) ? 'file://' : this . inferedDeviceRoot ;
3031 }
3132
3233 public attach ( args : IAttachRequestArgs ) : void {
@@ -55,18 +56,7 @@ export class PathTransformer implements IDebugTransformer {
5556 resolve ( ) ;
5657 }
5758 else if ( this . inferedDeviceRoot ) {
58- utils . Logger . log ( `Paths.setBP: No target url cached for client path: ${ url } . Using inffered device root to set breakpoint` ) ;
59-
60- let inferedUrl = null ;
61- if ( this . _platform == "android" ) {
62- inferedUrl = url . replace ( this . _webRoot , this . inferedDeviceRoot ) . replace ( / \\ / g, "/" ) ;
63- }
64- else if ( this . _platform === "ios" ) {
65- inferedUrl = url . replace ( this . _webRoot , "" ) . replace ( / \\ / g, "/" ) ;
66- }
67- else {
68- throw new Error ( "Not supported platform" ) ;
69- }
59+ let inferedUrl = url . replace ( this . _webRoot , this . inferedDeviceRoot ) . replace ( / \\ / g, "/" ) ;
7060
7161 //change device path if {N} core module or {N} module
7262 if ( inferedUrl . indexOf ( "/node_modules/tns-core-modules/" ) != - 1 )
@@ -79,18 +69,10 @@ export class PathTransformer implements IDebugTransformer {
7969 }
8070
8171 //change platform specific paths
82- if ( inferedUrl . indexOf ( ".android." ) != - 1 )
83- {
84- inferedUrl = inferedUrl . replace ( ".android." , "." ) ;
85- }
86- else if ( inferedUrl . indexOf ( ".ios." ) != - 1 )
87- {
88- inferedUrl = inferedUrl . replace ( ".ios." , "." ) ;
89- }
72+ inferedUrl = inferedUrl . replace ( `.${ this . _platform } .` , '.' ) ;
9073
9174 args . source . path = inferedUrl ;
92- this . _pendingBreakpointsByPath . set ( args . source . path , { resolve, reject, args } ) ;
93- utils . Logger . log ( "resolving infered promise on path " + url ) ;
75+ utils . Logger . log ( `Paths.setBP: Resolved (by infering) ${ url } to ${ args . source . path } ` ) ;
9476 resolve ( ) ;
9577 }
9678 else {
0 commit comments