2023-01-04 04:05:35 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Flow.Launcher.Infrastructure
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class FileExplorerHelper
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the path of the file explorer that is currently in the foreground
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static string GetActiveExplorerPath()
|
|
|
|
|
|
{
|
2026-02-24 11:52:23 +00:00
|
|
|
|
var explorerPath = DialogJump.DialogJump.GetActiveExplorerPath();
|
|
|
|
|
|
return !string.IsNullOrEmpty(explorerPath) ?
|
|
|
|
|
|
GetDirectoryPath(new Uri(explorerPath).LocalPath) :
|
|
|
|
|
|
null;
|
2025-02-12 02:21:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Get directory path from a file path
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private static string GetDirectoryPath(string path)
|
|
|
|
|
|
{
|
2026-02-24 11:52:23 +00:00
|
|
|
|
if (!path.EndsWith('\\'))
|
2025-02-12 02:21:14 +00:00
|
|
|
|
{
|
|
|
|
|
|
return path + "\\";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return path;
|
2023-01-04 04:05:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|