@@ -104,26 +104,27 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
104104 }
105105
106106 public async removeFile ( filePath : string ) : Promise < void > {
107- this . verifyActiveConnection ( ) ;
108- const filePathData = this . getFilePathData ( filePath ) ;
109- const headerBuffer = Buffer . alloc ( PROTOCOL_OPERATION_LENGTH_SIZE +
110- SIZE_BYTE_LENGTH +
111- filePathData . filePathLengthSize +
112- filePathData . filePathLengthBytes ) ;
113-
114- let offset = 0 ;
115- offset += headerBuffer . write ( AndroidLivesyncTool . DELETE_FILE_OPERATION . toString ( ) , offset , PROTOCOL_OPERATION_LENGTH_SIZE ) ;
116- offset = headerBuffer . writeInt8 ( filePathData . filePathLengthSize , offset ) ;
117- offset += headerBuffer . write ( filePathData . filePathLengthString , offset , filePathData . filePathLengthSize ) ;
118- headerBuffer . write ( filePathData . relativeFilePath , offset , filePathData . filePathLengthBytes ) ;
119- const hash = crypto . createHash ( "md5" ) . update ( headerBuffer ) . digest ( ) ;
120-
121- await this . writeToSocket ( headerBuffer ) ;
122- await this . writeToSocket ( hash ) ;
107+ this . verifyActiveConnection ( ) ;
108+ const filePathData = this . getFilePathData ( filePath ) ;
109+ const headerBuffer = Buffer . alloc ( PROTOCOL_OPERATION_LENGTH_SIZE +
110+ SIZE_BYTE_LENGTH +
111+ filePathData . filePathLengthSize +
112+ filePathData . filePathLengthBytes ) ;
113+
114+ let offset = 0 ;
115+ offset += headerBuffer . write ( AndroidLivesyncTool . DELETE_FILE_OPERATION . toString ( ) , offset , PROTOCOL_OPERATION_LENGTH_SIZE ) ;
116+ offset = headerBuffer . writeInt8 ( filePathData . filePathLengthSize , offset ) ;
117+ offset += headerBuffer . write ( filePathData . filePathLengthString , offset , filePathData . filePathLengthSize ) ;
118+ headerBuffer . write ( filePathData . relativeFilePath , offset , filePathData . filePathLengthBytes ) ;
119+ const hash = crypto . createHash ( "md5" ) . update ( headerBuffer ) . digest ( ) ;
120+
121+ await this . writeToSocket ( headerBuffer ) ;
122+ await this . writeToSocket ( hash ) ;
123123 }
124-
125- public removeFiles ( files : string [ ] ) {
126- return Promise . all ( files . map ( file => this . removeFile ( file ) ) ) ;
124+ public async removeFiles ( files : string [ ] ) : Promise < void > {
125+ for ( const file of files ) {
126+ await this . removeFile ( file ) ;
127+ }
127128 }
128129
129130 public generateOperationIdentifier ( ) : string {
@@ -265,6 +266,7 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
265266 const error = this . checkConnectionStatus ( ) ;
266267 if ( error && rejectHandler ) {
267268 rejectHandler ( error ) ;
269+ return false ;
268270 }
269271
270272 if ( error && ! rejectHandler ) {
0 commit comments