From 13d8110ce29a7d976c3e88dc4b330922964ac11a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 31 Oct 2016 23:07:45 -0400 Subject: make api project portable --- Emby.Common.Implementations/IO/ManagedFileSystem.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Emby.Common.Implementations/IO/ManagedFileSystem.cs') 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 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 GetDirectories(string path, bool recursive = false) { var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; -- cgit v1.2.3