[Feature] Address Feedback: Do not override user defined cache path

This commit is contained in:
Dongbo Wang 2018-07-10 22:53:39 -07:00
parent 0ac878f72c
commit add14e452f

View file

@ -1029,9 +1029,10 @@ namespace System.Management.Automation
{ {
// If user defines a custom cache path, then use that. // If user defines a custom cache path, then use that.
string userDefinedCachePath = Environment.GetEnvironmentVariable("PSModuleAnalysisCachePath"); string userDefinedCachePath = Environment.GetEnvironmentVariable("PSModuleAnalysisCachePath");
if (!String.IsNullOrEmpty(userDefinedCachePath)) if (!string.IsNullOrEmpty(userDefinedCachePath))
{ {
s_cacheStoreLocation = userDefinedCachePath; s_cacheStoreLocation = userDefinedCachePath;
return;
} }
string cacheFileName = "ModuleAnalysisCache"; string cacheFileName = "ModuleAnalysisCache";
@ -1057,7 +1058,7 @@ namespace System.Management.Automation
string allNames = string.Join(Environment.NewLine, featureNames); string allNames = string.Join(Environment.NewLine, featureNames);
// Use SHA1 because it's faster. // Use SHA1 because it's faster.
// It's very unlikely to get colision from hashing the combinations of enabled features names. // It's very unlikely to get collision from hashing the combinations of enabled features names.
byte[] hashBytes; byte[] hashBytes;
using (var sha1 = SHA1.Create()) using (var sha1 = SHA1.Create())
{ {