From 980795ba00fa66fe477e92f92e58509a30e39c2e Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Wed, 12 Feb 2025 10:21:14 +0800
Subject: [PATCH] Improve explorer path parse when path ends with backslash
---
.../FileExplorerHelper.cs | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/Flow.Launcher.Infrastructure/FileExplorerHelper.cs b/Flow.Launcher.Infrastructure/FileExplorerHelper.cs
index d908b0fde0a..b97c096c363 100644
--- a/Flow.Launcher.Infrastructure/FileExplorerHelper.cs
+++ b/Flow.Launcher.Infrastructure/FileExplorerHelper.cs
@@ -15,7 +15,20 @@ public static string GetActiveExplorerPath()
{
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;
+ }
+
+ ///
+ /// Get directory path from a file path
+ ///
+ private static string GetDirectoryPath(string path)
+ {
+ if (!path.EndsWith("\\"))
+ {
+ return path + "\\";
+ }
+
+ return path;
}
///