diff options
author | Chris Robinson <[email protected]> | 2018-01-13 03:41:56 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-01-13 03:41:56 -0800 |
commit | bbc4ebecabc9417f92fbc9a185edf7360f1a8b6e (patch) | |
tree | 28ab5013f261ef7a83bffd9acb441ae65c2ef211 /Alc/backends/pulseaudio.c | |
parent | 71ad3b17153e7cbf25c3c6c1fb04fedabf596ff6 (diff) |
Use GetProcBinary to get the executable name for PulseAudio
Diffstat (limited to 'Alc/backends/pulseaudio.c')
-rw-r--r-- | Alc/backends/pulseaudio.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c index 9f3c4762..3208bf26 100644 --- a/Alc/backends/pulseaudio.c +++ b/Alc/backends/pulseaudio.c @@ -334,18 +334,20 @@ static void wait_for_operation(pa_operation *op, pa_threaded_mainloop *loop) static pa_context *connect_context(pa_threaded_mainloop *loop, ALboolean silent) { const char *name = "OpenAL Soft"; - char path_name[PATH_MAX]; + al_string binname = AL_STRING_INIT_STATIC(); pa_context_state_t state; pa_context *context; int err; - if(pa_get_binary_name(path_name, sizeof(path_name))) - name = pa_path_get_filename(path_name); + GetProcBinary(NULL, &binname); + if(!alstr_empty(binname)) + name = alstr_get_cstr(binname); context = pa_context_new(pa_threaded_mainloop_get_api(loop), name); if(!context) { ERR("pa_context_new() failed\n"); + alstr_reset(&binname); return NULL; } @@ -372,9 +374,10 @@ static pa_context *connect_context(pa_threaded_mainloop *loop, ALboolean silent) if(!silent) ERR("Context did not connect: %s\n", pa_strerror(err)); pa_context_unref(context); - return NULL; + context = NULL; } + alstr_reset(&binname); return context; } |