internal FileInfo FindTool(DirectoryInfo androidHome, string toolName, string windowsExtension, params string[] pathSegments) { var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); var ext = isWindows ? windowsExtension : string.Empty; var home = AndroidSdkManager.FindHome(androidHome)?.FirstOrDefault(); if (home?.Exists ?? false) { var allSegments = new List <string>(); allSegments.Add(home.FullName); allSegments.AddRange(pathSegments); allSegments.Add(toolName + ext); var tool = Path.Combine(allSegments.ToArray()); if (File.Exists(tool)) { return(new FileInfo(tool)); } } return(null); }
public SdkTool(DirectoryInfo androidSdkHome) { AndroidSdkHome = AndroidSdkManager.FindHome(androidSdkHome)?.FirstOrDefault(); Jdks = new JdkLocator().Find()?.ToArray() ?? new JdkInfo[0]; }