Skip to content

Commit 175f3fa

Browse files
committed
Use GetProcessNameFromHwnd instead of GetProcessPathFromHwnd
1 parent 3e54889 commit 175f3fa

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Main.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,16 @@ public string GetTranslatedPluginDescription()
3636
IDialogJumpExplorerWindow? filesWindow = null;
3737

3838
// Is it from Files?
39-
string processName = Win32Helper.GetProcessPathFromHwnd(new(hwnd));
39+
string processName;
40+
try
41+
{
42+
processName = Win32Helper.GetProcessNameFromHwnd(new(hwnd));
43+
}
44+
catch (Exception e)
45+
{
46+
Context.API.LogWarn(ClassName, $"Failed to get process name: {e}");
47+
return null;
48+
}
4049
if (processName.Equals("files.exe", StringComparison.OrdinalIgnoreCase))
4150
{
4251
// Is it Files's file window?

0 commit comments

Comments
 (0)