fix scanner crash caused by invalid mtime (#934)

This commit is contained in:
Jason Dove
2022-08-20 19:56:37 -05:00
committed by GitHub
parent 7aff65f07b
commit 612b9e6524
2 changed files with 12 additions and 2 deletions
+11 -2
View File
@@ -33,8 +33,17 @@ public class LocalFileSystem : ILocalFileSystem
return Unit.Default;
}
public DateTime GetLastWriteTime(string path) =>
Try(File.GetLastWriteTimeUtc(path)).IfFail(() => SystemTime.MinValueUtc);
public DateTime GetLastWriteTime(string path)
{
try
{
return File.GetLastWriteTimeUtc(path);
}
catch
{
return SystemTime.MinValueUtc;
}
}
public bool IsLibraryPathAccessible(LibraryPath libraryPath) =>
Directory.Exists(libraryPath.Path);