@@ -23,7 +23,8 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
2323 constructor ( private $androidProcessService : Mobile . IAndroidProcessService ,
2424 private $errors : IErrors ,
2525 private $fs : IFileSystem ,
26- private $logger : ILogger ) {
26+ private $logger : ILogger ,
27+ private $mobileHelper : Mobile . IMobileHelper ) {
2728 this . operationPromises = Object . create ( null ) ;
2829 this . socketError = null ;
2930 this . socketConnection = null ;
@@ -38,6 +39,10 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
3839 this . $errors . fail ( `You need to provide "baseDir" as a configuration property!` ) ;
3940 }
4041
42+ if ( this . socketConnection ) {
43+ this . $errors . fail ( "Socket connection already exists." ) ;
44+ }
45+
4146 if ( ! configuration . localHostAddress ) {
4247 configuration . localHostAddress = DEFAULT_LOCAL_HOST_ADDRESS ;
4348 }
@@ -267,6 +272,8 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
267272 const error = new Error ( `Socket Error:\n${ err } ` ) ;
268273 if ( this . configuration . errorHandler ) {
269274 this . configuration . errorHandler ( error ) ;
275+ } else {
276+ this . handleSocketError ( socket . uid , error . message ) ;
270277 }
271278 } ) ;
272279 }
@@ -381,18 +388,9 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
381388 }
382389
383390 private resolveRelativePath ( filePath : string ) : string {
384- let relativeFilePath ;
385-
386- if ( this . configuration . appPlatformsPath ) {
387- relativeFilePath = path . relative ( this . configuration . appPlatformsPath , filePath ) ;
388- } else if ( this . appPlatformsPath ) {
389- relativeFilePath = path . relative ( this . appPlatformsPath , filePath ) ;
390- } else {
391- this . $errors . failWithoutHelp ( "You need to pass either \"baseDir\" " +
392- "when you initialize the tool or \"basePath\" as a second argument to this method!" ) ;
393- }
391+ const relativeFilePath = path . relative ( this . appPlatformsPath , filePath ) ;
394392
395- return relativeFilePath . split ( path . sep ) . join ( path . posix . sep ) ;
393+ return this . $mobileHelper . buildDevicePath ( relativeFilePath ) ;
396394 }
397395}
398396$injector . register ( "androidLivesyncLibrary" , AndroidLivesyncTool ) ;
0 commit comments