Browse Source

create _wenviron if not already done (close https://github.com/HaxeFoundation/hashlink/issues/175)

Nicolas Cannasse 7 years ago
parent
commit
edc62091dd
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/std/sys.c

+ 6 - 0
src/std/sys.c

@@ -200,6 +200,12 @@ HL_PRIM varray *hl_sys_env() {
 	pchar **e = environ;
 	pchar **arr;
 	int count = 0;
+#	ifdef HL_WIN_DESKTOP
+	if( e == NULL ) {
+		_wgetenv(L"");
+		e = environ;
+	}
+#	endif
 	while( *e ) {
 		pchar *x = pstrchr(*e,'=');
 		if( x == NULL ) {