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 @@ -1573,6 +1573,7 @@ int looks_like_command_line_option(const char *str)
15731573char * xdg_config_home_for (const char * subdir , const char * filename )
15741574{
15751575 const char * home , * config_home ;
1576+ char * home_config = NULL ;
15761577
15771578 assert (subdir );
15781579 assert (filename );
@@ -1581,10 +1582,26 @@ char *xdg_config_home_for(const char *subdir, const char *filename)
15811582 return mkpathdup ("%s/%s/%s" , config_home , subdir , filename );
15821583
15831584 home = getenv ("HOME" );
1584- if (home )
1585- return mkpathdup ("%s/.config/%s/%s" , home , subdir , filename );
1585+ if (home && * home )
1586+ home_config = mkpathdup ("%s/.config/%s/%s" , home , subdir , filename );
1587+
1588+ #ifdef WIN32
1589+ {
1590+ const char * appdata = getenv ("APPDATA" );
1591+ if (appdata && * appdata ) {
1592+ char * appdata_config = mkpathdup ("%s/Git/%s" , appdata , filename );
1593+ if (file_exists (appdata_config )) {
1594+ if (home_config && file_exists (home_config ))
1595+ warning ("'%s' was ignored because '%s' exists." , home_config , appdata_config );
1596+ free (home_config );
1597+ return appdata_config ;
1598+ }
1599+ free (appdata_config );
1600+ }
1601+ }
1602+ #endif
15861603
1587- return NULL ;
1604+ return home_config ;
15881605}
15891606
15901607char * xdg_config_home (const char * filename )
You can’t perform that action at this time.
0 commit comments