瀏覽代碼

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

Nicolas Cannasse 7 年之前
父節點
當前提交
edc62091dd
共有 1 個文件被更改,包括 6 次插入0 次删除
  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 ) {