Skip to content

Commit

Permalink
(chocolateyGH-338) Fix ensure_file_attribute_set
Browse files Browse the repository at this point in the history
Ensure file attribute set is ignoring the attributes passed in and only
looking at Hidden. Fix that to use the attributes passed in.
  • Loading branch information
ferventcoder committed Sep 17, 2015
1 parent 6523dc0 commit fce8a26
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -430,17 +430,21 @@ public void ensure_file_attribute_set(string path, FileAttributes attributes)
if (directory_exists(path))
{
var directoryInfo = get_directory_info_for(path);
if ((directoryInfo.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)
if ((directoryInfo.Attributes & attributes) != attributes)
{
directoryInfo.Attributes |= FileAttributes.Hidden;
this.Log().Debug(() => "Adding '{0}' attribute(s) to '{1}'.".format_with(attributes.to_string(), path));
directoryInfo.Attributes |= attributes;
}
}
if (file_exists(path))
{
var fileInfo = get_file_info_for(path);
if ((fileInfo.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)
if ((fileInfo.Attributes & attributes) != attributes)
{
fileInfo.Attributes |= FileAttributes.Hidden;
this.Log().Debug(() => "Adding '{0}' attribute(s) to '{1}'.".format_with(attributes.to_string(), path));
fileInfo.Attributes |= attributes;
}
}
}
}
}
Expand Down

0 comments on commit fce8a26

Please sign in to comment.