run method

  1. @override
FutureOr? run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
FutureOr? run() async {
  /// 获取操作缓存的项目主目录
  root = argResults?['root'] ?? Platform.environment['PWD']!;
  final iosUnityPath =
      argResults?['iosUnityPath'] ?? join('unity', 'meta_winner_unity_ios');
  final androidUnityPath = argResults?['androidUnityPath'] ??
      join('unity', 'meta_winner_unity_android');
  iosUnityDir = Directory(join(root, iosUnityPath));
  if (!await iosUnityDir.exists()) {
    logger.log('${iosUnityDir.path}路径不存在!', status: LogStatus.error);
    exit(1);
  }

  androidUnityDir = Directory(join(root, androidUnityPath));
  if (!await androidUnityDir.exists()) {
    logger.log('${androidUnityDir.path}路径不存在!', status: LogStatus.error);
    exit(1);
  }
  await cacheRun();
}