Skip to content

Commit

Permalink
don't fail the file extraction when we can't set last write time (#56370
Browse files Browse the repository at this point in the history
)
  • Loading branch information
adamsitnik authored Jul 28, 2021
1 parent cf52b7e commit b209dec
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,14 @@ public static void ExtractToFile(this ZipArchiveEntry source, string destination
ExtractExternalAttributes(fs, source);
}

File.SetLastWriteTime(destinationFileName, source.LastWriteTime.DateTime);
try
{
File.SetLastWriteTime(destinationFileName, source.LastWriteTime.DateTime);
}
catch (UnauthorizedAccessException)
{
// some OSes like Android (#35374) might not support setting the last write time, the extraction should not fail because of that
}
}

static partial void ExtractExternalAttributes(FileStream fs, ZipArchiveEntry entry);
Expand Down

0 comments on commit b209dec

Please sign in to comment.