File tree 1 file changed +14
-0
lines changed
fontique/src/backend/fontconfig
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ pub fn parse_config(path: &Path, sink: &mut impl ParserSink) {
30
30
if root. tag_name ( ) . name ( ) != "fontconfig" {
31
31
return ;
32
32
}
33
+ let mut has_cachedir = false ;
33
34
let mut prefer = vec ! [ ] ;
34
35
' outer: for child in root. children ( ) {
35
36
match child. tag_name ( ) . name ( ) {
@@ -65,6 +66,9 @@ pub fn parse_config(path: &Path, sink: &mut impl ParserSink) {
65
66
"cachedir" => {
66
67
if let Some ( path) = resolve_dir ( child, path) {
67
68
sink. cache_path ( & path) ;
69
+ if !has_cachedir {
70
+ has_cachedir = true ;
71
+ }
68
72
}
69
73
}
70
74
"include" => {
@@ -121,6 +125,16 @@ pub fn parse_config(path: &Path, sink: &mut impl ParserSink) {
121
125
_ => { }
122
126
}
123
127
}
128
+
129
+ if !has_cachedir {
130
+ if let Ok ( home) = config_home ( ) {
131
+ let default_cache_dir = std:: env:: var ( "XDG_CACHE_HOME" )
132
+ . map ( PathBuf :: from)
133
+ . unwrap_or ( Path :: new ( & home) . join ( ".cache" ) )
134
+ . join ( "fontconfig" ) ;
135
+ sink. cache_path ( & default_cache_dir) ;
136
+ }
137
+ }
124
138
}
125
139
126
140
/// Families we care about for aliases.
You can’t perform that action at this time.
0 commit comments