Flow.Launcher/Plugins/Flow.Launcher.Plugin.Explorer/Helper/PathHelper.cs

22 lines
623 B
C#
Raw Normal View History

2025-05-25 17:45:44 +00:00
using System;
using System.IO;
using System.Linq;
using Flow.Launcher.Plugin.Explorer.Search;
namespace Flow.Launcher.Plugin.Explorer.Helper;
2025-05-25 19:11:03 +00:00
public static class PathHelper
2025-05-25 17:45:44 +00:00
{
public static string GetPathName(this string selectedPath)
{
2025-06-07 05:52:12 +00:00
if (string.IsNullOrEmpty(selectedPath)) return string.Empty;
2025-05-25 17:45:44 +00:00
var path = selectedPath.EndsWith(Constants.DirectorySeparator) ? selectedPath[0..^1] : selectedPath;
if (path.EndsWith(':'))
return path[0..^1] + " Drive";
return path.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None)
.Last();
}
}