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 3, 2017
1 parent 617d74a commit 9835125
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(!fileSystem.get_directory_info_for(config.CacheLocation).Name.is_equal_to("chocolatey")) {
config.CacheLocation = fileSystem.combine_paths(fileSystem.get_temp_path(), "chocolatey");
}
}
Expand Down

0 comments on commit 9835125

Please sign in to comment.