File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
fontique/src/backend/fontconfig Expand file tree Collapse file tree 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) {
3030 if root. tag_name ( ) . name ( ) != "fontconfig" {
3131 return ;
3232 }
33+ let mut has_cachedir = false ;
3334 let mut prefer = vec ! [ ] ;
3435 ' outer: for child in root. children ( ) {
3536 match child. tag_name ( ) . name ( ) {
@@ -65,6 +66,9 @@ pub fn parse_config(path: &Path, sink: &mut impl ParserSink) {
6566 "cachedir" => {
6667 if let Some ( path) = resolve_dir ( child, path) {
6768 sink. cache_path ( & path) ;
69+ if !has_cachedir {
70+ has_cachedir = true ;
71+ }
6872 }
6973 }
7074 "include" => {
@@ -121,6 +125,16 @@ pub fn parse_config(path: &Path, sink: &mut impl ParserSink) {
121125 _ => { }
122126 }
123127 }
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+ }
124138}
125139
126140/// Families we care about for aliases.
You can’t perform that action at this time.
0 commit comments