util: manually extract the program name from program_invocation_name
Glibc has the same code to get program_invocation_short_name. However for some reason the short name gets mangled for some wine apps. For example with Google Earth VR I get: program_invocation_name: "/home/tarceri/.local/share/Steam/steamapps/common/EarthVR/Earth.exe" program_invocation_short_name: "e" Acked-by: Eric Engestrom <eric.engestrom@intel.com>
This commit is contained in:
@@ -45,7 +45,16 @@
|
|||||||
/* These aren't declared in any libc5 header */
|
/* These aren't declared in any libc5 header */
|
||||||
extern char *program_invocation_name, *program_invocation_short_name;
|
extern char *program_invocation_name, *program_invocation_short_name;
|
||||||
# endif
|
# endif
|
||||||
# define GET_PROGRAM_NAME() program_invocation_short_name
|
static const char *
|
||||||
|
__getProgramName()
|
||||||
|
{
|
||||||
|
char * arg = strrchr(program_invocation_name, '/');
|
||||||
|
if (arg)
|
||||||
|
return arg+1;
|
||||||
|
else
|
||||||
|
return program_invocation_name;
|
||||||
|
}
|
||||||
|
# define GET_PROGRAM_NAME() __getProgramName()
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
# define GET_PROGRAM_NAME() program_invocation_short_name
|
# define GET_PROGRAM_NAME() program_invocation_short_name
|
||||||
#elif defined(__FreeBSD__) && (__FreeBSD__ >= 2)
|
#elif defined(__FreeBSD__) && (__FreeBSD__ >= 2)
|
||||||
|
Reference in New Issue
Block a user