mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Add a win32 version of vkd3d_get_program_name.
This commit is contained in:
parent
962096f179
commit
d6b1e62ffc
Notes:
Alexandre Julliard
2024-05-08 22:51:40 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/832
@ -901,6 +901,30 @@ bool vkd3d_get_program_name(char program_name[PATH_MAX])
|
||||
return true;
|
||||
}
|
||||
|
||||
#elif defined(WIN32)
|
||||
|
||||
bool vkd3d_get_program_name(char program_name[PATH_MAX])
|
||||
{
|
||||
char buffer[MAX_PATH];
|
||||
char *p, *name;
|
||||
size_t len;
|
||||
|
||||
*program_name = '\0';
|
||||
len = GetModuleFileNameA(NULL, buffer, ARRAY_SIZE(buffer));
|
||||
if (!(len && len < MAX_PATH))
|
||||
return false;
|
||||
|
||||
name = buffer;
|
||||
if ((p = strrchr(name, '/')))
|
||||
name = p + 1;
|
||||
if ((p = strrchr(name, '\\')))
|
||||
name = p + 1;
|
||||
|
||||
len = strlen(name) + 1;
|
||||
memcpy(program_name, name, len);
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
bool vkd3d_get_program_name(char program_name[PATH_MAX])
|
||||
|
Loading…
Reference in New Issue
Block a user