aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/c_src/wxe_ps_init.c
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2018-01-22 12:04:26 +0100
committerDan Gudmundsson <[email protected]>2018-01-22 12:04:26 +0100
commitd51c21fca9a4af46b9322b1425ed0a29ed50fd77 (patch)
tree5a92bb052bc81289b9c86d0804299df50f09d05f /lib/wx/c_src/wxe_ps_init.c
parent68a0f569410f7375c44a9d806930b1172c1d92a8 (diff)
downloadotp-d51c21fca9a4af46b9322b1425ed0a29ed50fd77.tar.gz
otp-d51c21fca9a4af46b9322b1425ed0a29ed50fd77.tar.bz2
otp-d51c21fca9a4af46b9322b1425ed0a29ed50fd77.zip
wx: open_port doesn't allow 0 terminated strings anymore
Fix getenv usage. And remove set path it is automagically done by driver interface.
Diffstat (limited to 'lib/wx/c_src/wxe_ps_init.c')
-rw-r--r--lib/wx/c_src/wxe_ps_init.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/wx/c_src/wxe_ps_init.c b/lib/wx/c_src/wxe_ps_init.c
index e6b677d469..277f3ac25f 100644
--- a/lib/wx/c_src/wxe_ps_init.c
+++ b/lib/wx/c_src/wxe_ps_init.c
@@ -61,13 +61,20 @@ int is_packaged_app() {
void * wxe_ps_init2() {
NSAutoreleasePool *pool;
ProcessSerialNumber psn;
-
+ size_t app_len = 127;
+ char app_title_buf[128];
+ char * app_title;
// Setup and enable gui
pool = [[NSAutoreleasePool alloc] init];
-
+
if( !is_packaged_app() ) {
// Undocumented function (but no documented way of doing this exists)
- char *app_title = getenv("WX_APP_TITLE");
+ int res = erl_drv_getenv("WX_APP_TITLE", app_title_buf, &app_len);
+ if (res >= 0) {
+ app_title = app_title_buf;
+ } else {
+ app_title = NULL;
+ }
if(!GetCurrentProcess(&psn)) {
CPSSetProcessName(&psn, app_title?app_title:"Erlang");
}