File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -3289,6 +3289,18 @@ static size_t append_system_bin_dirs(char *path, size_t size)
3289
3289
}
3290
3290
#endif
3291
3291
3292
+ static int is_system32_path (const char * path )
3293
+ {
3294
+ WCHAR system32 [MAX_LONG_PATH ], wpath [MAX_LONG_PATH ];
3295
+
3296
+ if (xutftowcs_long_path (wpath , path ) < 0 ||
3297
+ !GetSystemDirectoryW (system32 , ARRAY_SIZE (system32 )) ||
3298
+ _wcsicmp (system32 , wpath ))
3299
+ return 0 ;
3300
+
3301
+ return 1 ;
3302
+ }
3303
+
3292
3304
static void setup_windows_environment (void )
3293
3305
{
3294
3306
char * tmp = getenv ("TMPDIR" );
@@ -3329,7 +3341,8 @@ static void setup_windows_environment(void)
3329
3341
strbuf_addstr (& buf , tmp );
3330
3342
if ((tmp = getenv ("HOMEPATH" ))) {
3331
3343
strbuf_addstr (& buf , tmp );
3332
- if (is_directory (buf .buf ))
3344
+ if (!is_system32_path (buf .buf ) &&
3345
+ is_directory (buf .buf ))
3333
3346
setenv ("HOME" , buf .buf , 1 );
3334
3347
else
3335
3348
tmp = NULL ; /* use $USERPROFILE */
You can’t perform that action at this time.
0 commit comments