mirror of https://github.com/lidarr/Lidarr
Fixed: File browser ordering and volume name
This commit is contained in:
parent
d3a35108df
commit
6878804705
|
@ -431,6 +431,13 @@ namespace NzbDrone.Common.Disk
|
||||||
return new FileStream(path, FileMode.Open, FileAccess.Read);
|
return new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DriveInfo> GetDrives()
|
||||||
|
{
|
||||||
|
return DriveInfo.GetDrives()
|
||||||
|
.Where(d => d.DriveType == DriveType.Fixed || d.DriveType == DriveType.Network)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
public List<DirectoryInfo> GetDirectoryInfos(string path)
|
public List<DirectoryInfo> GetDirectoryInfos(string path)
|
||||||
{
|
{
|
||||||
Ensure.That(path, () => path).IsValidPath();
|
Ensure.That(path, () => path).IsValidPath();
|
||||||
|
|
|
@ -103,12 +103,12 @@ namespace NzbDrone.Common.Disk
|
||||||
|
|
||||||
private List<FileSystemModel> GetDrives()
|
private List<FileSystemModel> GetDrives()
|
||||||
{
|
{
|
||||||
return _diskProvider.GetFixedDrives()
|
return _diskProvider.GetDrives()
|
||||||
.Select(d => new FileSystemModel
|
.Select(d => new FileSystemModel
|
||||||
{
|
{
|
||||||
Type = FileSystemEntityType.Drive,
|
Type = FileSystemEntityType.Drive,
|
||||||
Name = d,
|
Name = GetVolumeName(d),
|
||||||
Path = d,
|
Path = d.Name,
|
||||||
LastModified = null
|
LastModified = null
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -117,6 +117,7 @@ namespace NzbDrone.Common.Disk
|
||||||
private List<FileSystemModel> GetDirectories(string path)
|
private List<FileSystemModel> GetDirectories(string path)
|
||||||
{
|
{
|
||||||
var directories = _diskProvider.GetDirectoryInfos(path)
|
var directories = _diskProvider.GetDirectoryInfos(path)
|
||||||
|
.OrderBy(d => d.Name)
|
||||||
.Select(d => new FileSystemModel
|
.Select(d => new FileSystemModel
|
||||||
{
|
{
|
||||||
Name = d.Name,
|
Name = d.Name,
|
||||||
|
@ -134,6 +135,7 @@ namespace NzbDrone.Common.Disk
|
||||||
private List<FileSystemModel> GetFiles(string path)
|
private List<FileSystemModel> GetFiles(string path)
|
||||||
{
|
{
|
||||||
return _diskProvider.GetFileInfos(path)
|
return _diskProvider.GetFileInfos(path)
|
||||||
|
.OrderBy(d => d.Name)
|
||||||
.Select(d => new FileSystemModel
|
.Select(d => new FileSystemModel
|
||||||
{
|
{
|
||||||
Name = d.Name,
|
Name = d.Name,
|
||||||
|
@ -156,6 +158,16 @@ namespace NzbDrone.Common.Disk
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetVolumeName(DriveInfo driveInfo)
|
||||||
|
{
|
||||||
|
if (driveInfo.VolumeLabel.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
return driveInfo.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.Format("{0} ({1})", driveInfo.Name, driveInfo.VolumeLabel);
|
||||||
|
}
|
||||||
|
|
||||||
private string GetParent(string path)
|
private string GetParent(string path)
|
||||||
{
|
{
|
||||||
var di = new DirectoryInfo(path);
|
var di = new DirectoryInfo(path);
|
||||||
|
|
|
@ -46,6 +46,7 @@ namespace NzbDrone.Common.Disk
|
||||||
string[] GetFixedDrives();
|
string[] GetFixedDrives();
|
||||||
string GetVolumeLabel(string path);
|
string GetVolumeLabel(string path);
|
||||||
FileStream StreamFile(string path);
|
FileStream StreamFile(string path);
|
||||||
|
List<DriveInfo> GetDrives();
|
||||||
List<DirectoryInfo> GetDirectoryInfos(string path);
|
List<DirectoryInfo> GetDirectoryInfos(string path);
|
||||||
List<FileInfo> GetFileInfos(string path);
|
List<FileInfo> GetFileInfos(string path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,11 @@ define(
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type === 'folder') {
|
else if (type === 'folder') {
|
||||||
icon = 'icon-folder-close';
|
icon = 'icon-folder-close-alt';
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type === 'file') {
|
else if (type === 'file') {
|
||||||
icon = 'icon-file';
|
icon = 'icon-file-alt';
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$el.html('<i class="{0}"></i>'.format(icon));
|
this.$el.html('<i class="{0}"></i>'.format(icon));
|
||||||
|
|
Loading…
Reference in New Issue