File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -2813,6 +2813,18 @@ static size_t append_system_bin_dirs(char *path, size_t size)
2813
2813
}
2814
2814
#endif
2815
2815
2816
+ static int is_system32_path (const char * path )
2817
+ {
2818
+ WCHAR system32 [MAX_LONG_PATH ], wpath [MAX_LONG_PATH ];
2819
+
2820
+ if (xutftowcs_long_path (wpath , path ) < 0 ||
2821
+ !GetSystemDirectoryW (system32 , ARRAY_SIZE (system32 )) ||
2822
+ _wcsicmp (system32 , wpath ))
2823
+ return 0 ;
2824
+
2825
+ return 1 ;
2826
+ }
2827
+
2816
2828
static void setup_windows_environment (void )
2817
2829
{
2818
2830
char * tmp = getenv ("TMPDIR" );
@@ -2853,7 +2865,8 @@ static void setup_windows_environment(void)
2853
2865
strbuf_addstr (& buf , tmp );
2854
2866
if ((tmp = getenv ("HOMEPATH" ))) {
2855
2867
strbuf_addstr (& buf , tmp );
2856
- if (is_directory (buf .buf ))
2868
+ if (!is_system32_path (buf .buf ) &&
2869
+ is_directory (buf .buf ))
2857
2870
setenv ("HOME" , buf .buf , 1 );
2858
2871
else
2859
2872
tmp = NULL ; /* use $USERPROFILE */
You can’t perform that action at this time.
0 commit comments