Flow.Launcher/Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/FolderLink.cs

30 lines
777 B
C#
Raw Normal View History

using System;
2020-06-06 12:13:22 +00:00
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
2020-06-06 12:13:22 +00:00
namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
{
public class FolderLink
{
public string Path { get; set; }
[JsonIgnore]
2020-06-06 12:13:22 +00:00
public string Nickname
{
get
{
var path = Path.EndsWith(Constants.DirectorySeperator) ? Path[0..^1] : Path;
if (path.EndsWith(':'))
return path[0..^1] + " Drive";
return path.Split(new[] { System.IO.Path.DirectorySeparatorChar }, StringSplitOptions.None)
.Last()
+ " (" + System.IO.Path.GetDirectoryName(Path) + ")";
}
}
}
}