@@ -2218,6 +2218,22 @@ int handle_long_path(wchar_t *path, int len, int max_path, int expand)
2218
2218
}
2219
2219
}
2220
2220
2221
+ static void setup_windows_environment ()
2222
+ {
2223
+ /* on Windows it is TMP and TEMP */
2224
+ if (!getenv ("TMPDIR" )) {
2225
+ const char * tmp = getenv ("TMP" );
2226
+ if (!tmp )
2227
+ tmp = getenv ("TEMP" );
2228
+ if (tmp )
2229
+ setenv ("TMPDIR" , tmp , 1 );
2230
+ }
2231
+
2232
+ /* simulate TERM to enable auto-color (see color.c) */
2233
+ if (!getenv ("TERM" ))
2234
+ setenv ("TERM" , "cygwin" , 1 );
2235
+ }
2236
+
2221
2237
/*
2222
2238
* Disable MSVCRT command line wildcard expansion (__getmainargs called from
2223
2239
* mingw startup code, see init.c in mingw runtime).
@@ -2314,19 +2330,7 @@ void mingw_startup()
2314
2330
qsort (environ , i , sizeof (char * ), compareenv );
2315
2331
2316
2332
/* fix Windows specific environment settings */
2317
-
2318
- /* on Windows it is TMP and TEMP */
2319
- if (!mingw_getenv ("TMPDIR" )) {
2320
- const char * tmp = mingw_getenv ("TMP" );
2321
- if (!tmp )
2322
- tmp = mingw_getenv ("TEMP" );
2323
- if (tmp )
2324
- setenv ("TMPDIR" , tmp , 1 );
2325
- }
2326
-
2327
- /* simulate TERM to enable auto-color (see color.c) */
2328
- if (!getenv ("TERM" ))
2329
- setenv ("TERM" , "cygwin" , 1 );
2333
+ setup_windows_environment ();
2330
2334
2331
2335
/*
2332
2336
* Avoid a segmentation fault when cURL tries to set the CHARSET
0 commit comments