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 @@ -2816,6 +2816,18 @@ static size_t append_system_bin_dirs(char *path, size_t size)
2816
2816
}
2817
2817
#endif
2818
2818
2819
+ static int is_system32_path (const char * path )
2820
+ {
2821
+ WCHAR system32 [MAX_LONG_PATH ], wpath [MAX_LONG_PATH ];
2822
+
2823
+ if (xutftowcs_long_path (wpath , path ) < 0 ||
2824
+ !GetSystemDirectoryW (system32 , ARRAY_SIZE (system32 )) ||
2825
+ _wcsicmp (system32 , wpath ))
2826
+ return 0 ;
2827
+
2828
+ return 1 ;
2829
+ }
2830
+
2819
2831
static void setup_windows_environment (void )
2820
2832
{
2821
2833
char * tmp = getenv ("TMPDIR" );
@@ -2856,7 +2868,8 @@ static void setup_windows_environment(void)
2856
2868
strbuf_addstr (& buf , tmp );
2857
2869
if ((tmp = getenv ("HOMEPATH" ))) {
2858
2870
strbuf_addstr (& buf , tmp );
2859
- if (is_directory (buf .buf ))
2871
+ if (!is_system32_path (buf .buf ) &&
2872
+ is_directory (buf .buf ))
2860
2873
setenv ("HOME" , buf .buf , 1 );
2861
2874
else
2862
2875
tmp = NULL ; /* use $USERPROFILE */
You can’t perform that action at this time.
0 commit comments