Merge pull request #3238 from Jack251970/active_explorer_path

Improve explorer path parse when path ends with backslash
This commit is contained in:
Kevin Zhang 2025-02-16 23:26:29 -08:00 committed by GitHub
commit e0d2af2bdd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,7 +15,20 @@ namespace Flow.Launcher.Infrastructure
{
var explorerWindow = GetActiveExplorer();
string locationUrl = explorerWindow?.LocationURL;
return !string.IsNullOrEmpty(locationUrl) ? new Uri(locationUrl).LocalPath + "\\" : null;
return !string.IsNullOrEmpty(locationUrl) ? GetDirectoryPath(new Uri(locationUrl).LocalPath) : null;
}
/// <summary>
/// Get directory path from a file path
/// </summary>
private static string GetDirectoryPath(string path)
{
if (!path.EndsWith("\\"))
{
return path + "\\";
}
return path;
}
/// <summary>