@@ -2209,6 +2209,22 @@ int handle_long_path(wchar_t *path, int len, int max_path, int expand)
2209
2209
}
2210
2210
}
2211
2211
2212
+ static void setup_windows_environment ()
2213
+ {
2214
+ /* on Windows it is TMP and TEMP */
2215
+ if (!getenv ("TMPDIR" )) {
2216
+ const char * tmp = getenv ("TMP" );
2217
+ if (!tmp )
2218
+ tmp = getenv ("TEMP" );
2219
+ if (tmp )
2220
+ setenv ("TMPDIR" , tmp , 1 );
2221
+ }
2222
+
2223
+ /* simulate TERM to enable auto-color (see color.c) */
2224
+ if (!getenv ("TERM" ))
2225
+ setenv ("TERM" , "cygwin" , 1 );
2226
+ }
2227
+
2212
2228
/*
2213
2229
* Disable MSVCRT command line wildcard expansion (__getmainargs called from
2214
2230
* mingw startup code, see init.c in mingw runtime).
@@ -2305,19 +2321,7 @@ void mingw_startup()
2305
2321
qsort (environ , i , sizeof (char * ), compareenv );
2306
2322
2307
2323
/* fix Windows specific environment settings */
2308
-
2309
- /* on Windows it is TMP and TEMP */
2310
- if (!mingw_getenv ("TMPDIR" )) {
2311
- const char * tmp = mingw_getenv ("TMP" );
2312
- if (!tmp )
2313
- tmp = mingw_getenv ("TEMP" );
2314
- if (tmp )
2315
- setenv ("TMPDIR" , tmp , 1 );
2316
- }
2317
-
2318
- /* simulate TERM to enable auto-color (see color.c) */
2319
- if (!getenv ("TERM" ))
2320
- setenv ("TERM" , "cygwin" , 1 );
2324
+ setup_windows_environment ();
2321
2325
2322
2326
/*
2323
2327
* Avoid a segmentation fault when cURL tries to set the CHARSET
0 commit comments