function getProjectData($injector, hookArgs) {
  const projectDir =
    hookArgs && hookArgs.prepareData && hookArgs.prepareData.projectDir;
  const $projectDataService = $injector.resolve('projectDataService');
  const projectData = $projectDataService.getProjectData(projectDir);
  return projectData;
}

export function getPlatformFromPrepareHookArgs(hookArgs) {
  const platform = (
    (hookArgs &&
      (hookArgs.platform ||
        (hookArgs.prepareData && hookArgs.prepareData.platform))) ||
    ''
  ).toLowerCase();
  return platform;
}

export function getNativeProjectDir($injector, platform, hookArgs) {
  const service = $injector.resolve('platformsDataService');
  const projectData = getProjectData($injector, hookArgs);
  const platformData = service.getPlatformData(platform, projectData);

  return platformData.projectRoot;
}
