From 777d3e599d6faa6c4fce7bfed161f3f666a4142d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 6 Mar 2026 14:07:47 +0800 Subject: [PATCH] WM (macOS): fixes issues raised by Copilot --- src/detection/wm/wm_apple.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/detection/wm/wm_apple.m b/src/detection/wm/wm_apple.m index a310f5774..bf40cc93f 100644 --- a/src/detection/wm/wm_apple.m +++ b/src/detection/wm/wm_apple.m @@ -39,7 +39,7 @@ const char* ffDetectWMPlugin(FFstrbuf* pluginName) if (instance.config.general.detectVersion) { char buf[PROC_PIDPATHINFO_MAXSIZE]; - int length = proc_pidpath(proc->kp_proc.p_pid, buf, ARRAY_SIZE(buf)); + int length = proc_pidpath(proc->kp_proc.p_pid, buf, ARRAY_SIZE(buf) - strlen("Info.plist")); if (length > 0) { char* lastSlash = strrchr(buf, '/'); @@ -55,7 +55,9 @@ const char* ffDetectWMPlugin(FFstrbuf* pluginName) error:&error]; if (dict) { - ffStrbufSetS(pluginName, [dict[@"CFBundleName"] UTF8String]); + NSString* name = dict[@"CFBundleDisplayName"] ?: dict[@"CFBundleName"]; + ffStrbufSetS(pluginName, name.UTF8String ?: comm); + NSString* version = dict[@"CFBundleShortVersionString"]; if (version) { @@ -95,7 +97,7 @@ const char* ffDetectWMVersion(const FFstrbuf* wmName, FFstrbuf* result, FF_MAYBE } if (dict) - ffStrbufInitS(result, ((NSString*) dict[@"CFBundleShortVersionString"]).UTF8String); + ffStrbufSetS(result, ((NSString*) dict[@"CFBundleShortVersionString"]).UTF8String); } return NULL;