mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
Cleaned up environment detection
This commit is contained in:
@@ -87,19 +87,26 @@ namespace NzbDrone.Common.Disk
|
||||
public bool FileExists(string path)
|
||||
{
|
||||
Ensure.That(path, () => path).IsValidPath();
|
||||
return FileExists(path, OsInfo.IsMono);
|
||||
return FileExists(path, OsInfo.PathStringComparison);
|
||||
}
|
||||
|
||||
public bool FileExists(string path, bool caseSensitive)
|
||||
public bool FileExists(string path, StringComparison stringComparison)
|
||||
{
|
||||
Ensure.That(path, () => path).IsValidPath();
|
||||
|
||||
if (caseSensitive)
|
||||
switch (stringComparison)
|
||||
{
|
||||
return File.Exists(path) && path == path.GetActualCasing();
|
||||
case StringComparison.CurrentCulture:
|
||||
case StringComparison.InvariantCulture:
|
||||
case StringComparison.Ordinal:
|
||||
{
|
||||
return File.Exists(path) && path == path.GetActualCasing();
|
||||
}
|
||||
default:
|
||||
{
|
||||
return File.Exists(path);
|
||||
}
|
||||
}
|
||||
|
||||
return File.Exists(path);
|
||||
}
|
||||
|
||||
public string[] GetDirectories(string path)
|
||||
|
||||
Reference in New Issue
Block a user