Skip to content

Commit

Permalink
(chocolateyGH-1231) Use DirectoryInfo to evaluate CacheLocation
Browse files Browse the repository at this point in the history
The former fix (chocolateyGH-1210) fails when the CacheLocation ends with a slash. This uses a DirectoryInfo instance to examine the last directory in the path in a more robust manner
  • Loading branch information
mwrock committed Apr 4, 2017
1 parent 2d8fe15 commit 75fb33b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ private static void set_config_items(ChocolateyConfiguration config, ConfigFileS
config.CacheLocation = fileSystem.get_temp_path(); // System.Environment.GetEnvironmentVariable("TEMP");
// TEMP gets set in EnvironmentSettings, so it may already have
// chocolatey in the path when it installs the next package from
// the API.
if(!config.CacheLocation.EndsWith("chocolatey")) {
// the API.
if(!String.Equals(fileSystem.get_directory_info_for(config.CacheLocation).Name, "chocolatey", StringComparison.OrdinalIgnoreCase)) {
config.CacheLocation = fileSystem.combine_paths(fileSystem.get_temp_path(), "chocolatey");
}
}
Expand Down

0 comments on commit 75fb33b

Please sign in to comment.