lv2 ui_get_hostinfo macos using GetCurrentProcess

This commit is contained in:
Paolo Marrone 2025-09-22 13:04:55 +02:00
parent 09c1598c20
commit 9b775088e5

View File

@ -551,6 +551,9 @@ LV2_SYMBOL_EXPORT const LV2_Descriptor * lv2_descriptor(uint32_t index) {
#elif defined(__APPLE__) #elif defined(__APPLE__)
# include <libproc.h> # include <libproc.h>
# include <unistd.h> # include <unistd.h>
#else
# include <windows.h>
# include <psapi.h>
#endif #endif
typedef struct { typedef struct {
@ -583,6 +586,16 @@ static const char * ui_get_hostinfo(void *handle) {
} }
instance->processname[127] = 0; instance->processname[127] = 0;
return instance->processname; return instance->processname;
#else
ui_instance *instance = (ui_instance *)handle;
HANDLE process_handle = GetCurrentProcess();
if (GetModuleBaseNameA(process_handle, NULL, instance->processname, 128) == 0) {
CloseHandle(process_handle);
return NULL;
}
CloseHandle(process_handle);
instance->processname[127] = 0;
return instance->processname;
#endif #endif
} }