aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/EnvironmentService.cs
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 /MediaBrowser.Api/EnvironmentService.cs
parentb28857feea210a40f984e69517bcbafbfb639773 (diff)
make api project portable
Diffstat (limited to 'MediaBrowser.Api/EnvironmentService.cs')
-rw-r--r--MediaBrowser.Api/EnvironmentService.cs27
1 files changed, 6 insertions, 21 deletions
diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.cs
index c05446fbb..bab538c91 100644
--- a/MediaBrowser.Api/EnvironmentService.cs
+++ b/MediaBrowser.Api/EnvironmentService.cs
@@ -4,12 +4,8 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Net;
using System;
using System.Collections.Generic;
-using System.Globalization;
using System.IO;
using System.Linq;
-using MediaBrowser.Common.IO;
-using MediaBrowser.Controller.IO;
-using MediaBrowser.Model.IO;
using MediaBrowser.Model.Services;
namespace MediaBrowser.Api
@@ -110,6 +106,7 @@ namespace MediaBrowser.Api
public class EnvironmentService : BaseApiService
{
const char UncSeparator = '\\';
+ const string UncSeparatorString = "\\";
/// <summary>
/// The _network manager
@@ -139,7 +136,7 @@ namespace MediaBrowser.Api
try
{
var qnap = "/share/CACHEDEV1_DATA";
- if (Directory.Exists(qnap))
+ if (_fileSystem.DirectoryExists(qnap))
{
result.Path = qnap;
}
@@ -166,7 +163,7 @@ namespace MediaBrowser.Api
throw new ArgumentNullException("Path");
}
- var networkPrefix = UncSeparator.ToString(CultureInfo.InvariantCulture) + UncSeparator.ToString(CultureInfo.InvariantCulture);
+ var networkPrefix = UncSeparatorString + UncSeparatorString;
if (path.StartsWith(networkPrefix, StringComparison.OrdinalIgnoreCase) && path.LastIndexOf(UncSeparator) == 1)
{
@@ -203,13 +200,11 @@ namespace MediaBrowser.Api
/// <returns>IEnumerable{FileSystemEntryInfo}.</returns>
private IEnumerable<FileSystemEntryInfo> 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 FileSystemEntryInfo
+ return _fileSystem.GetDrives().Select(d => new FileSystemEntryInfo
{
- Name = GetName(d),
- Path = d.RootDirectory.FullName,
+ Name = d.Name,
+ Path = d.FullName,
Type = FileSystemEntryType.Directory
-
});
}
@@ -228,16 +223,6 @@ namespace MediaBrowser.Api
}
/// <summary>
- /// Gets the name.
- /// </summary>
- /// <param name="drive">The drive.</param>
- /// <returns>System.String.</returns>
- private string GetName(DriveInfo drive)
- {
- return drive.Name;
- }
-
- /// <summary>
/// Gets the network shares.
/// </summary>
/// <param name="path">The path.</param>