File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 11#include "../git-compat-util.h"
22#include "win32.h"
33#include <conio.h>
4+ #include <shlobj.h>
45#include <wchar.h>
56#include "../strbuf.h"
67#include "../run-command.h"
@@ -2382,8 +2383,16 @@ void mingw_startup()
23822383const char * windows_wide_config (void )
23832384{
23842385 static struct strbuf windows_wide = STRBUF_INIT ;
2385- if (!windows_wide .len )
2386- strbuf_addf (& windows_wide ,
2387- "%s\\Git\\config" , getenv ("PROGRAMDATA" ));
2388- return windows_wide .buf ;
2386+ if (!windows_wide .len ) {
2387+ char wbuffer [MAX_PATH ];
2388+ if (SHGetFolderPathW (NULL , CSIDL_COMMON_APPDATA , NULL ,
2389+ SHGFP_TYPE_CURRENT , wbuffer ) != S_OK )
2390+ strbuf_addch (& windows_wide , '\0' );
2391+ else {
2392+ char buffer [MAX_PATH ];
2393+ xwcstoutf (buffer , wbuffer , sizeof (buffer ));
2394+ strbuf_addf (& windows_wide , "%s\\Git\\config" , buffer );
2395+ }
2396+ }
2397+ return * windows_wide .buf ? windows_wide .buf : NULL ;
23892398}
You can’t perform that action at this time.
0 commit comments