aboutsummaryrefslogtreecommitdiff
path: root/Emby.Common.Implementations
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-10-31 23:07:45 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-10-31 23:07:45 -0400
commit13d8110ce29a7d976c3e88dc4b330922964ac11a (patch)
treeddc2a61bfd9d001224aa640e220c7903ac62cb74 /Emby.Common.Implementations
parentb28857feea210a40f984e69517bcbafbfb639773 (diff)
make api project portable
Diffstat (limited to 'Emby.Common.Implementations')
-rw-r--r--Emby.Common.Implementations/IO/ManagedFileSystem.cs17
-rw-r--r--Emby.Common.Implementations/project.json3
2 files changed, 19 insertions, 1 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;
diff --git a/Emby.Common.Implementations/project.json b/Emby.Common.Implementations/project.json
index 4cb5213ba..444d0e13e 100644
--- a/Emby.Common.Implementations/project.json
+++ b/Emby.Common.Implementations/project.json
@@ -43,7 +43,8 @@
"MediaBrowser.Model": {
"target": "project"
},
- "System.Net.Requests": "4.0.11",
+ "System.IO.FileSystem.DriveInfo": "4.0.0",
+ "System.Net.Requests": "4.0.11",
"System.Xml.XmlSerializer": "4.0.11",
"System.Net.Http": "4.1.0",
"System.Net.Primitives": "4.0.11",