Skip to content

Commit b7e9bf7

Browse files
Fix adding specific platform (#2907)
When trying to execute `tns platform add <platform>@<version>` we fail with message: `Cannot read property 'platformProjectService' of undefined` The reason is incorrect check when getting platforms-data where we do not expect the version. Split the incoming string by `@` and use the real platform when trying to get the platforms data.
1 parent fc128fd commit b7e9bf7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/platforms-data.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ export class PlatformsData implements IPlatformsData {
1515
}
1616

1717
public getPlatformData(platform: string, projectData: IProjectData): IPlatformData {
18-
return this.platformsData[platform.toLowerCase()] && this.platformsData[platform.toLowerCase()].getPlatformData(projectData);
18+
const platformKey = platform && _.first(platform.toLowerCase().split("@"));
19+
let platformData: IPlatformData;
20+
if (platformKey) {
21+
platformData = this.platformsData[platformKey] && this.platformsData[platformKey].getPlatformData(projectData);
22+
}
23+
24+
return platformData;
1925
}
2026

2127
public get availablePlatforms(): any {

0 commit comments

Comments
 (0)