/// <summary> /// Retrieves hashes for all R package names in a given folder /// </summary> /// <returns></returns> public static IEnumerable <string> GetInstalledPackageHashes(RPackageType packageType) { string rInstallPath = RInstallation.GetRInstallPath(RToolsSettings.Current.RBasePath, null, VsAppShell.Current); if (!string.IsNullOrEmpty(rInstallPath)) { IEnumerable <string> packageNames = Enumerable.Empty <string>(); if (packageType == RPackageType.Base) { packageNames = FolderUtility.GetSubfolderRelativePaths(Path.Combine(rInstallPath, "library")); } else { Version v = RInstallation.GetRVersionFromFolderName(rInstallPath.Substring(rInstallPath.LastIndexOf('\\') + 1)); if (v.Major > 0) { string userLibraryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"R\win-library\", v.Major.ToString() + "." + v.Minor.ToString()); packageNames = FolderUtility.GetSubfolderRelativePaths(userLibraryPath); } } foreach (string p in packageNames) { string hash = CalculateMD5Hash(p); yield return(hash); } } }