aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Lavado <anthonylavado@users.noreply.github.com>2019-06-04 00:19:35 -0400
committerGitHub <noreply@github.com>2019-06-04 00:19:35 -0400
commita623dd19219467a1d7d642bc63f0343520563586 (patch)
tree34989cdf7981012c83b4001a90ad066297bdcb85
parent6b6776042c0c456c128734056e28765f1717ffc7 (diff)
parentb768ad978efdb653022dc490055688d321f2bf34 (diff)
Merge pull request #1368 from dkanada/drives
Only return useful drives
-rw-r--r--Emby.Server.Implementations/IO/ManagedFileSystem.cs10
1 files changed, 4 insertions, 6 deletions
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
index 0dea5041a..7c2ea50e2 100644
--- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
@@ -647,7 +647,6 @@ namespace Emby.Server.Implementations.IO
public virtual bool IsPathFile(string path)
{
// Cannot use Path.IsPathRooted because it returns false under mono when using windows-based paths, e.g. C:\\
-
if (path.IndexOf("://", StringComparison.OrdinalIgnoreCase) != -1 &&
!path.StartsWith("file://", StringComparison.OrdinalIgnoreCase))
{
@@ -655,8 +654,6 @@ namespace Emby.Server.Implementations.IO
}
return true;
-
- //return Path.IsPathRooted(path);
}
public virtual void DeleteFile(string path)
@@ -667,13 +664,14 @@ namespace Emby.Server.Implementations.IO
public virtual List<FileSystemMetadata> GetDrives()
{
- // Only include drives in the ready state or this method could end up being very slow, waiting for drives to timeout
- return DriveInfo.GetDrives().Where(d => d.IsReady).Select(d => new FileSystemMetadata
+ // check for ready state to avoid waiting for drives to timeout
+ // some drives on linux have no actual size or are used for other purposes
+ return DriveInfo.GetDrives().Where(d => d.IsReady && d.TotalSize != 0 && d.DriveType != DriveType.Ram)
+ .Select(d => new FileSystemMetadata
{
Name = d.Name,
FullName = d.RootDirectory.FullName,
IsDirectory = true
-
}).ToList();
}