@@ -27,6 +27,7 @@ export class PathTransformer implements IDebugTransformer {
27
27
public launch ( args : ILaunchRequestArgs ) : void {
28
28
this . _webRoot = utils . getAppRoot ( args ) ;
29
29
this . _platform = args . platform ;
30
+ this . inferedDeviceRoot = ( this . _platform === 'ios' ) ? 'file://' : this . inferedDeviceRoot ;
30
31
}
31
32
32
33
public attach ( args : IAttachRequestArgs ) : void {
@@ -55,18 +56,7 @@ export class PathTransformer implements IDebugTransformer {
55
56
resolve ( ) ;
56
57
}
57
58
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, "/" ) ;
70
60
71
61
//change device path if {N} core module or {N} module
72
62
if ( inferedUrl . indexOf ( "/node_modules/tns-core-modules/" ) != - 1 )
@@ -79,18 +69,10 @@ export class PathTransformer implements IDebugTransformer {
79
69
}
80
70
81
71
//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 } .` , '.' ) ;
90
73
91
74
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 } ` ) ;
94
76
resolve ( ) ;
95
77
}
96
78
else {
0 commit comments