@@ -2,7 +2,7 @@ export class PutFileCommand implements ICommand {
2
2
constructor ( private $devicesService : Mobile . IDevicesService ,
3
3
private $stringParameter : ICommandParameter ,
4
4
private $options : IOptions ,
5
- private $project : Project . IProjectBase ,
5
+ private $projectData : IProjectData ,
6
6
private $errors : IErrors ) { }
7
7
8
8
allowedParameters : ICommandParameter [ ] = [ this . $stringParameter , this . $stringParameter , this . $stringParameter ] ;
@@ -11,12 +11,21 @@ export class PutFileCommand implements ICommand {
11
11
await this . $devicesService . initialize ( { deviceId : this . $options . device , skipInferPlatform : true } ) ;
12
12
let appIdentifier = args [ 2 ] ;
13
13
14
- if ( ! appIdentifier && ! this . $project . projectData ) {
15
- this . $errors . failWithoutHelp ( "Please enter application identifier or execute this command in project." ) ;
14
+ if ( ! appIdentifier ) {
15
+ try {
16
+ this . $projectData . initializeProjectData ( ) ;
17
+ } catch ( err ) {
18
+ // ignore the error
19
+ }
20
+ if ( ! this . $projectData . projectIdentifiers ) {
21
+ this . $errors . failWithoutHelp ( "Please enter application identifier or execute this command in project." ) ;
22
+ }
16
23
}
17
24
18
- appIdentifier = appIdentifier || this . $project . projectData . AppIdentifier ;
19
- const action = ( device : Mobile . IDevice ) => device . fileSystem . putFile ( args [ 0 ] , args [ 1 ] , appIdentifier ) ;
25
+ const action = async ( device : Mobile . IDevice ) => {
26
+ appIdentifier = appIdentifier || this . $projectData . projectIdentifiers [ device . deviceInfo . platform . toLowerCase ( ) ] ;
27
+ await device . fileSystem . putFile ( args [ 0 ] , args [ 1 ] , appIdentifier ) ;
28
+ } ;
20
29
await this . $devicesService . execute ( action ) ;
21
30
}
22
31
}
0 commit comments