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 @@ -1523,6 +1523,7 @@ int looks_like_command_line_option(const char *str)
1523
1523
char * xdg_config_home_for (const char * subdir , const char * filename )
1524
1524
{
1525
1525
const char * home , * config_home ;
1526
+ char * home_config = NULL ;
1526
1527
1527
1528
assert (subdir );
1528
1529
assert (filename );
@@ -1531,10 +1532,26 @@ char *xdg_config_home_for(const char *subdir, const char *filename)
1531
1532
return mkpathdup ("%s/%s/%s" , config_home , subdir , filename );
1532
1533
1533
1534
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
1536
1553
1537
- return NULL ;
1554
+ return home_config ;
1538
1555
}
1539
1556
1540
1557
char * xdg_config_home (const char * filename )
You can’t perform that action at this time.
0 commit comments