Skip to content

Commit

Permalink
Fixed bug for real now
Browse files Browse the repository at this point in the history
  • Loading branch information
devedse committed Aug 10, 2020
1 parent 85090f8 commit d02d0b7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions WebOptimizationProject/GitHubRepositoryOptimizer.cs
Expand Up @@ -177,21 +177,18 @@ private async Task<IEnumerable<OptimizableFile>> GoOptimize(string dir, WopConfi
return optimizedFileResults;
}

private void CleanupRecursively(string path)
private static void CleanupRecursively(string path)
{
foreach (var file in Directory.GetFiles(path))
{
FileAttributes attributes = File.GetAttributes(path);
if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
FileInfo fileInfo = new FileInfo(file);
if (fileInfo.IsReadOnly)
{
// Show the file.
attributes = attributes & ~FileAttributes.ReadOnly;
File.SetAttributes(path, attributes);
Console.WriteLine($"Removing readonly flag for: {path}");
fileInfo.IsReadOnly = false;
Console.WriteLine($"Removing readonly flag for: {file}");
}

Console.WriteLine($"Deleting file: {file}");

File.Delete(file);
}

Expand Down

0 comments on commit d02d0b7

Please sign in to comment.