Fixed: Checking for an existing file will respect the OSes case-sensitivity
This commit is contained in:
parent
e5e00fd346
commit
6ee4b6d428
|
@ -5,7 +5,7 @@ using System.Security.AccessControl;
|
||||||
using System.Security.Principal;
|
using System.Security.Principal;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.EnsureThat;
|
using NzbDrone.Common.EnsureThat;
|
||||||
using NzbDrone.Common.Exceptions;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Instrumentation;
|
using NzbDrone.Common.Instrumentation;
|
||||||
|
|
||||||
namespace NzbDrone.Common.Disk
|
namespace NzbDrone.Common.Disk
|
||||||
|
@ -106,17 +106,19 @@ namespace NzbDrone.Common.Disk
|
||||||
public bool FileExists(string path)
|
public bool FileExists(string path)
|
||||||
{
|
{
|
||||||
Ensure.That(path, () => path).IsValidPath();
|
Ensure.That(path, () => path).IsValidPath();
|
||||||
return File.Exists(path);
|
return FileExists(path, OsInfo.IsMono);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool FileExists(string path, bool caseSensitive)
|
public bool FileExists(string path, bool caseSensitive)
|
||||||
{
|
{
|
||||||
|
Ensure.That(path, () => path).IsValidPath();
|
||||||
|
|
||||||
if (caseSensitive)
|
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)
|
public string[] GetDirectories(string path)
|
||||||
|
@ -315,6 +317,7 @@ namespace NzbDrone.Common.Disk
|
||||||
|
|
||||||
File.SetLastWriteTime(path, dateTime);
|
File.SetLastWriteTime(path, dateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FileSetLastAccessTime(string path, DateTime dateTime)
|
public void FileSetLastAccessTime(string path, DateTime dateTime)
|
||||||
{
|
{
|
||||||
Ensure.That(path, () => path).IsValidPath();
|
Ensure.That(path, () => path).IsValidPath();
|
||||||
|
|
Loading…
Reference in New Issue