Skip to content

Commit e0d2af2

Browse files
authored
Merge pull request #3238 from Jack251970/active_explorer_path
Improve explorer path parse when path ends with backslash
2 parents 741ddfe + 980795b commit e0d2af2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Flow.Launcher.Infrastructure/FileExplorerHelper.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,20 @@ public static string GetActiveExplorerPath()
1515
{
1616
var explorerWindow = GetActiveExplorer();
1717
string locationUrl = explorerWindow?.LocationURL;
18-
return !string.IsNullOrEmpty(locationUrl) ? new Uri(locationUrl).LocalPath + "\\" : null;
18+
return !string.IsNullOrEmpty(locationUrl) ? GetDirectoryPath(new Uri(locationUrl).LocalPath) : null;
19+
}
20+
21+
/// <summary>
22+
/// Get directory path from a file path
23+
/// </summary>
24+
private static string GetDirectoryPath(string path)
25+
{
26+
if (!path.EndsWith("\\"))
27+
{
28+
return path + "\\";
29+
}
30+
31+
return path;
1932
}
2033

2134
/// <summary>

0 commit comments

Comments
 (0)