util/u_process: implement util_get_process_name for Windows
There's not yet any users of this function on Windows, but it prints a warning during builds, and seems easy enough to implement. So let's add a trivial implementation. Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7548>
This commit is contained in:
committed by
Marge Bot
parent
d442a99238
commit
1a5400a9e9
@@ -135,6 +135,23 @@ __getProgramName()
|
||||
}
|
||||
|
||||
# define GET_PROGRAM_NAME() __getProgramName()
|
||||
#elif defined(WIN32)
|
||||
static const char *
|
||||
__getProgramName()
|
||||
{
|
||||
static const char *progname;
|
||||
if (progname == NULL) {
|
||||
static char buf[MAX_PATH];
|
||||
GetModuleFileNameA(NULL, buf, sizeof(buf));
|
||||
progname = strrchr(buf, '\\');
|
||||
if (progname)
|
||||
progname++;
|
||||
else
|
||||
progname = buf;
|
||||
}
|
||||
return progname;
|
||||
}
|
||||
# define GET_PROGRAM_NAME() __getProgramName()
|
||||
#endif
|
||||
|
||||
#if !defined(GET_PROGRAM_NAME)
|
||||
|
||||
Reference in New Issue
Block a user