File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -1523,6 +1523,7 @@ int looks_like_command_line_option(const char *str)
15231523char * xdg_config_home_for (const char * subdir , const char * filename )
15241524{
15251525 const char * home , * config_home ;
1526+ char * home_config = NULL ;
15261527
15271528 assert (subdir );
15281529 assert (filename );
@@ -1531,10 +1532,26 @@ char *xdg_config_home_for(const char *subdir, const char *filename)
15311532 return mkpathdup ("%s/%s/%s" , config_home , subdir , filename );
15321533
15331534 home = getenv ("HOME" );
1534- if (home )
1535- return mkpathdup ("%s/.config/%s/%s" , home , subdir , filename );
1535+ if (home && * home )
1536+ home_config = mkpathdup ("%s/.config/%s/%s" , home , subdir , filename );
1537+
1538+ #ifdef WIN32
1539+ {
1540+ const char * appdata = getenv ("APPDATA" );
1541+ if (appdata && * appdata ) {
1542+ char * appdata_config = mkpathdup ("%s/Git/%s" , appdata , filename );
1543+ if (file_exists (appdata_config )) {
1544+ if (home_config && file_exists (home_config ))
1545+ warning ("'%s' was ignored because '%s' exists." , home_config , appdata_config );
1546+ free (home_config );
1547+ return appdata_config ;
1548+ }
1549+ free (appdata_config );
1550+ }
1551+ }
1552+ #endif
15361553
1537- return NULL ;
1554+ return home_config ;
15381555}
15391556
15401557char * xdg_config_home (const char * filename )
You can’t perform that action at this time.
0 commit comments