Added: Include APFS disks in disk space calculation.

This commit is contained in:
Leonardo Galli 2017-12-12 22:46:00 +01:00
parent f36716135b
commit 948af901da
2 changed files with 11 additions and 17 deletions

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -116,21 +116,14 @@ namespace NzbDrone.Mono.Disk
public override List<IMount> GetMounts()
{
var mounts = GetDriveInfoMounts().Select(d => new DriveInfoMount(d, FindDriveType.Find(d.DriveFormat)))
.Where(d => d.DriveType == DriveType.Fixed || d.DriveType == DriveType.Network || d.DriveType == DriveType.Removable);
var procMounts = _procMountProvider.GetMounts();
if (procMounts != null)
{
return mounts.Concat(procMounts).DistinctBy(v => v.RootDirectory)
.ToList();
}
return mounts.Cast<IMount>().DistinctBy(v => v.RootDirectory)
.ToList();
return _procMountProvider.GetMounts()
.Concat(GetDriveInfoMounts()
.Select(d => new DriveInfoMount(d, FindDriveType.Find(d.DriveFormat)))
.Where(d => d.DriveType == DriveType.Fixed ||
d.DriveType == DriveType.Network ||
d.DriveType == DriveType.Removable))
.DistinctBy(v => v.RootDirectory)
.ToList();
}
public override long? GetTotalSize(string path)

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using NzbDrone.Common.Extensions;
@ -9,6 +9,7 @@ namespace NzbDrone.Mono.Disk
private static readonly Dictionary<string, DriveType> DriveTypeMap = new Dictionary<string, DriveType>
{
{ "afpfs", DriveType.Network },
{ "apfs", DriveType.Fixed },
{ "zfs", DriveType.Fixed }
};