From 6ee4b6d428c2cfbeb7bb24675bf3f3ba0a5cba51 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 31 Jul 2014 12:33:56 -0700 Subject: [PATCH] Fixed: Checking for an existing file will respect the OSes case-sensitivity --- src/NzbDrone.Common/Disk/DiskProviderBase.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Common/Disk/DiskProviderBase.cs b/src/NzbDrone.Common/Disk/DiskProviderBase.cs index 1a07168e2..91bf3ae30 100644 --- a/src/NzbDrone.Common/Disk/DiskProviderBase.cs +++ b/src/NzbDrone.Common/Disk/DiskProviderBase.cs @@ -5,7 +5,7 @@ using System.Security.AccessControl; using System.Security.Principal; using NLog; using NzbDrone.Common.EnsureThat; -using NzbDrone.Common.Exceptions; +using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Instrumentation; namespace NzbDrone.Common.Disk @@ -106,17 +106,19 @@ namespace NzbDrone.Common.Disk public bool FileExists(string path) { Ensure.That(path, () => path).IsValidPath(); - return File.Exists(path); + return FileExists(path, OsInfo.IsMono); } public bool FileExists(string path, bool caseSensitive) { + Ensure.That(path, () => path).IsValidPath(); + if (caseSensitive) { - return FileExists(path) && path == path.GetActualCasing(); + return File.Exists(path) && path == path.GetActualCasing(); } - return FileExists(path); + return File.Exists(path); } public string[] GetDirectories(string path) @@ -315,6 +317,7 @@ namespace NzbDrone.Common.Disk File.SetLastWriteTime(path, dateTime); } + public void FileSetLastAccessTime(string path, DateTime dateTime) { Ensure.That(path, () => path).IsValidPath();