Skip to content

Commit dd40c9d

Browse files
fix: platform remove command fails with old Android runtime
After upgrading `nativescript-doctor`, the version of the Java is validated against the current Android runtime version. In case the runtime version cannot work with Java 10, `nativescript-doctor` does not allow the operation to continue. This breaks the `platform remove` command, as it checks the system requirements first, before executing the actual removal. However, this is no longer required as the code for removing the platform is `try-catched` and in case the current environment is not setup correctly, it will try to remove the platforms/<platform> dir and the respective key in package.json. So remove the environment validation from this command. Also remove the `validatePlatformInstalled` call from the `canExecute` method of the command, as it is actually called in the `removePlatforms` method.
1 parent 255bd92 commit dd40c9d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/commands/remove-platform.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ export class RemovePlatformCommand implements ICommand {
33

44
constructor(private $platformService: IPlatformService,
55
private $projectData: IProjectData,
6-
private $errors: IErrors,
7-
private $platformsData: IPlatformsData) {
6+
private $errors: IErrors) {
87
this.$projectData.initializeProjectData();
98
}
109

@@ -17,12 +16,9 @@ export class RemovePlatformCommand implements ICommand {
1716
this.$errors.fail("No platform specified. Please specify a platform to remove");
1817
}
1918

20-
for (const platform of args) {
21-
this.$platformService.validatePlatformInstalled(platform, this.$projectData);
22-
const platformData = this.$platformsData.getPlatformData(platform, this.$projectData);
23-
const platformProjectService = platformData.platformProjectService;
24-
await platformProjectService.validate(this.$projectData);
25-
}
19+
_.each(args, platform => {
20+
this.$platformService.validatePlatform(platform, this.$projectData);
21+
});
2622

2723
return true;
2824
}

0 commit comments

Comments
 (0)