@@ -2,7 +2,7 @@ export class PutFileCommand implements ICommand {
22 constructor ( private $devicesService : Mobile . IDevicesService ,
33 private $stringParameter : ICommandParameter ,
44 private $options : IOptions ,
5- private $project : Project . IProjectBase ,
5+ private $projectData : IProjectData ,
66 private $errors : IErrors ) { }
77
88 allowedParameters : ICommandParameter [ ] = [ this . $stringParameter , this . $stringParameter , this . $stringParameter ] ;
@@ -11,12 +11,17 @@ export class PutFileCommand implements ICommand {
1111 await this . $devicesService . initialize ( { deviceId : this . $options . device , skipInferPlatform : true } ) ;
1212 let appIdentifier = args [ 2 ] ;
1313
14- if ( ! appIdentifier && ! this . $project . projectData ) {
15- this . $errors . failWithoutHelp ( "Please enter application identifier or execute this command in project." ) ;
14+ if ( ! appIdentifier ) {
15+ this . $projectData . initializeProjectDataSafe ( ) ;
16+ if ( ! this . $projectData . projectIdentifiers ) {
17+ this . $errors . failWithoutHelp ( "Please enter application identifier or execute this command in project." ) ;
18+ }
1619 }
1720
18- appIdentifier = appIdentifier || this . $project . projectData . AppIdentifier ;
19- const action = ( device : Mobile . IDevice ) => device . fileSystem . putFile ( args [ 0 ] , args [ 1 ] , appIdentifier ) ;
21+ const action = async ( device : Mobile . IDevice ) => {
22+ appIdentifier = appIdentifier || this . $projectData . projectIdentifiers [ device . deviceInfo . platform . toLowerCase ( ) ] ;
23+ await device . fileSystem . putFile ( args [ 0 ] , args [ 1 ] , appIdentifier ) ;
24+ } ;
2025 await this . $devicesService . execute ( action ) ;
2126 }
2227}
0 commit comments