fixed some tests, cleaned up root folders.
This commit is contained in:
@@ -1,20 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using PetaPoco;
|
||||
using Sqo.Attributes;
|
||||
|
||||
namespace NzbDrone.Core.RootFolders
|
||||
{
|
||||
|
||||
[TableName("RootDirs")]
|
||||
[PrimaryKey("Id", autoIncrement = true)]
|
||||
public class RootFolder : BaseRepositoryModel
|
||||
{
|
||||
public string Path { get; set; }
|
||||
|
||||
[ResultColumn]
|
||||
[Ignore]
|
||||
public ulong FreeSpace { get; set; }
|
||||
|
||||
[Ignore]
|
||||
public List<string> UnmappedFolders { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,7 @@ namespace NzbDrone.Core.RootFolders
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//This way we only need to implement none_custom methods for repos, like custom queries etc... rest is done automagically.
|
||||
|
||||
public class RootFolderRepository : BasicRepository<RootFolder>, IRootFolderRepository
|
||||
{
|
||||
public RootFolderRepository(IObjectDatabase objectDatabase)
|
||||
@@ -16,10 +15,5 @@ namespace NzbDrone.Core.RootFolders
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RootFolder Add(RootFolder rootFolder)
|
||||
{
|
||||
return ObjectDatabase.Insert(rootFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,11 @@ namespace NzbDrone.Core.RootFolders
|
||||
|
||||
rootFolders.ForEach(folder =>
|
||||
{
|
||||
folder.FreeSpace = _diskProvider.FreeDiskSpace(new DirectoryInfo(folder.Path));
|
||||
folder.UnmappedFolders = GetUnmappedFolders(folder.Path);
|
||||
if (_diskProvider.FolderExists(folder.Path))
|
||||
{
|
||||
folder.FreeSpace = _diskProvider.FreeDiskSpace(folder.Path);
|
||||
folder.UnmappedFolders = GetUnmappedFolders(folder.Path);
|
||||
}
|
||||
});
|
||||
|
||||
return rootFolders;
|
||||
@@ -58,7 +61,7 @@ namespace NzbDrone.Core.RootFolders
|
||||
|
||||
_rootFolderRepository.Add(rootFolder);
|
||||
|
||||
rootFolder.FreeSpace = _diskProvider.FreeDiskSpace(new DirectoryInfo(rootFolder.Path));
|
||||
rootFolder.FreeSpace = _diskProvider.FreeDiskSpace(rootFolder.Path);
|
||||
rootFolder.UnmappedFolders = GetUnmappedFolders(rootFolder.Path);
|
||||
return rootFolder;
|
||||
}
|
||||
@@ -108,7 +111,7 @@ namespace NzbDrone.Core.RootFolders
|
||||
{
|
||||
try
|
||||
{
|
||||
freeSpace.Add(pathRoot, _diskProvider.FreeDiskSpace(new DirectoryInfo(rootDir.Path)));
|
||||
freeSpace.Add(pathRoot, _diskProvider.FreeDiskSpace(rootDir.Path));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user