File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
fontique/src/backend/fontconfig Expand file tree Collapse file tree 1 file changed +12
-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 cachedir_count = 0 ;
3334 let mut prefer = vec ! [ ] ;
3435 ' outer: for child in root. children ( ) {
3536 match child. tag_name ( ) . name ( ) {
@@ -65,6 +66,7 @@ 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+ cachedir_count += 1 ;
6870 }
6971 }
7072 "include" => {
@@ -121,6 +123,16 @@ pub fn parse_config(path: &Path, sink: &mut impl ParserSink) {
121123 _ => { }
122124 }
123125 }
126+
127+ if cachedir_count == 0 {
128+ if let Ok ( home) = config_home ( ) {
129+ let default_cache_dir = std:: env:: var ( "XDG_CACHE_HOME" )
130+ . map ( PathBuf :: from)
131+ . unwrap_or ( Path :: new ( & home) . join ( ".cache" ) )
132+ . join ( "fontconfig" ) ;
133+ sink. cache_path ( & default_cache_dir) ;
134+ }
135+ }
124136}
125137
126138/// Families we care about for aliases.
You can’t perform that action at this time.
0 commit comments