@@ -2226,6 +2226,22 @@ int handle_long_path(wchar_t *path, int len, int max_path, int expand)
2226
2226
}
2227
2227
}
2228
2228
2229
+ static void setup_windows_environment ()
2230
+ {
2231
+ /* on Windows it is TMP and TEMP */
2232
+ if (!getenv ("TMPDIR" )) {
2233
+ const char * tmp = getenv ("TMP" );
2234
+ if (!tmp )
2235
+ tmp = getenv ("TEMP" );
2236
+ if (tmp )
2237
+ setenv ("TMPDIR" , tmp , 1 );
2238
+ }
2239
+
2240
+ /* simulate TERM to enable auto-color (see color.c) */
2241
+ if (!getenv ("TERM" ))
2242
+ setenv ("TERM" , "cygwin" , 1 );
2243
+ }
2244
+
2229
2245
/*
2230
2246
* Disable MSVCRT command line wildcard expansion (__getmainargs called from
2231
2247
* mingw startup code, see init.c in mingw runtime).
@@ -2322,19 +2338,7 @@ void mingw_startup()
2322
2338
qsort (environ , i , sizeof (char * ), compareenv );
2323
2339
2324
2340
/* fix Windows specific environment settings */
2325
-
2326
- /* on Windows it is TMP and TEMP */
2327
- if (!mingw_getenv ("TMPDIR" )) {
2328
- const char * tmp = mingw_getenv ("TMP" );
2329
- if (!tmp )
2330
- tmp = mingw_getenv ("TEMP" );
2331
- if (tmp )
2332
- setenv ("TMPDIR" , tmp , 1 );
2333
- }
2334
-
2335
- /* simulate TERM to enable auto-color (see color.c) */
2336
- if (!getenv ("TERM" ))
2337
- setenv ("TERM" , "cygwin" , 1 );
2341
+ setup_windows_environment ();
2338
2342
2339
2343
/*
2340
2344
* Avoid a segmentation fault when cURL tries to set the CHARSET
0 commit comments