mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Only set last write time for recycling bin on Windows
This commit is contained in:
parent
69c680ed87
commit
74ff7803a9
@ -57,8 +57,12 @@ public void DeleteFolder(string path)
|
|||||||
_diskProvider.FolderSetLastWriteTimeUtc(destination, DateTime.UtcNow);
|
_diskProvider.FolderSetLastWriteTimeUtc(destination, DateTime.UtcNow);
|
||||||
foreach (var file in _diskProvider.GetFiles(destination, SearchOption.AllDirectories))
|
foreach (var file in _diskProvider.GetFiles(destination, SearchOption.AllDirectories))
|
||||||
{
|
{
|
||||||
|
if (OsInfo.IsWindows)
|
||||||
|
{
|
||||||
|
//TODO: Better fix than this for non-Windows?
|
||||||
_diskProvider.FileSetLastWriteTimeUtc(file, DateTime.UtcNow);
|
_diskProvider.FileSetLastWriteTimeUtc(file, DateTime.UtcNow);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
logger.Debug("Folder has been moved to the recycling bin: {0}", destination);
|
logger.Debug("Folder has been moved to the recycling bin: {0}", destination);
|
||||||
}
|
}
|
||||||
@ -73,7 +77,7 @@ public void DeleteFile(string path)
|
|||||||
{
|
{
|
||||||
logger.Info("Recycling Bin has not been configured, deleting permanently.");
|
logger.Info("Recycling Bin has not been configured, deleting permanently.");
|
||||||
|
|
||||||
if (!OsInfo.IsMono)
|
if (OsInfo.IsWindows)
|
||||||
{
|
{
|
||||||
logger.Debug(_diskProvider.GetFileAttributes(path));
|
logger.Debug(_diskProvider.GetFileAttributes(path));
|
||||||
}
|
}
|
||||||
@ -103,7 +107,13 @@ public void DeleteFile(string path)
|
|||||||
|
|
||||||
logger.Debug("Moving '{0}' to '{1}'", path, destination);
|
logger.Debug("Moving '{0}' to '{1}'", path, destination);
|
||||||
_diskProvider.MoveFile(path, destination, true);
|
_diskProvider.MoveFile(path, destination, true);
|
||||||
|
|
||||||
|
//TODO: Better fix than this for non-Windows?
|
||||||
|
if (OsInfo.IsWindows)
|
||||||
|
{
|
||||||
_diskProvider.FileSetLastWriteTimeUtc(destination, DateTime.UtcNow);
|
_diskProvider.FileSetLastWriteTimeUtc(destination, DateTime.UtcNow);
|
||||||
|
}
|
||||||
|
|
||||||
logger.Debug("File has been moved to the recycling bin: {0}", destination);
|
logger.Debug("File has been moved to the recycling bin: {0}", destination);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user