mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-23 14:55:20 -07:00
parent
61ee8edb5a
commit
57adf0e3a5
2 changed files with 12 additions and 0 deletions
|
@ -294,12 +294,22 @@ namespace NzbDrone.Common.Disk
|
||||||
{
|
{
|
||||||
Ensure.That(path, () => path).IsValidPath();
|
Ensure.That(path, () => path).IsValidPath();
|
||||||
|
|
||||||
|
if (dateTime.Before(DateTimeExtensions.Epoch))
|
||||||
|
{
|
||||||
|
dateTime = DateTimeExtensions.Epoch;
|
||||||
|
}
|
||||||
|
|
||||||
Directory.SetLastWriteTimeUtc(path, dateTime);
|
Directory.SetLastWriteTimeUtc(path, dateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FileSetLastWriteTime(string path, DateTime dateTime)
|
public void FileSetLastWriteTime(string path, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Ensure.That(path, () => path).IsValidPath();
|
Ensure.That(path, () => path).IsValidPath();
|
||||||
|
|
||||||
|
if (dateTime.Before(DateTimeExtensions.Epoch))
|
||||||
|
{
|
||||||
|
dateTime = DateTimeExtensions.Epoch;
|
||||||
|
}
|
||||||
|
|
||||||
File.SetLastWriteTime(path, dateTime);
|
File.SetLastWriteTime(path, dateTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,5 +38,7 @@ namespace NzbDrone.Common.Extensions
|
||||||
{
|
{
|
||||||
return dateTime >= afterDateTime && dateTime <= beforeDateTime;
|
return dateTime >= afterDateTime && dateTime <= beforeDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue