aboutsummaryrefslogtreecommitdiff
path: root/Emby.Common.Implementations/IO/ManagedFileSystem.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Common.Implementations/IO/ManagedFileSystem.cs')
-rw-r--r--Emby.Common.Implementations/IO/ManagedFileSystem.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/Emby.Common.Implementations/IO/ManagedFileSystem.cs b/Emby.Common.Implementations/IO/ManagedFileSystem.cs
index bfc316d3f..a8aa1a3cd 100644
--- a/Emby.Common.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Common.Implementations/IO/ManagedFileSystem.cs
@@ -577,6 +577,23 @@ namespace Emby.Common.Implementations.IO
Directory.CreateDirectory(path);
}
+ public 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
+ {
+ Name = GetName(d),
+ FullName = d.RootDirectory.FullName,
+ IsDirectory = true
+
+ }).ToList();
+ }
+
+ private string GetName(DriveInfo drive)
+ {
+ return drive.Name;
+ }
+
public IEnumerable<FileSystemMetadata> GetDirectories(string path, bool recursive = false)
{
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;