File tree 1 file changed +20
-3
lines changed
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)
1573
1573
char * xdg_config_home_for (const char * subdir , const char * filename )
1574
1574
{
1575
1575
const char * home , * config_home ;
1576
+ char * home_config = NULL ;
1576
1577
1577
1578
assert (subdir );
1578
1579
assert (filename );
@@ -1581,10 +1582,26 @@ char *xdg_config_home_for(const char *subdir, const char *filename)
1581
1582
return mkpathdup ("%s/%s/%s" , config_home , subdir , filename );
1582
1583
1583
1584
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
1586
1603
1587
- return NULL ;
1604
+ return home_config ;
1588
1605
}
1589
1606
1590
1607
char * xdg_config_home (const char * filename )
You can’t perform that action at this time.
0 commit comments