File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -3,16 +3,19 @@ use std::collections::HashMap;
3
3
use anyhow:: Result ;
4
4
use serde:: { Deserialize , Deserializer } ;
5
5
6
- use crate :: MERGED_YAZI ;
7
-
8
6
/// Schemes in configuration file.
9
7
#[ derive( Debug ) ]
10
8
pub struct Schemes {
11
9
pub rules : Vec < Scheme > ,
12
10
}
13
11
14
12
impl Default for Schemes {
15
- fn default ( ) -> Self { toml:: from_str ( & MERGED_YAZI ) . unwrap ( ) }
13
+ fn default ( ) -> Self {
14
+ let schemes_path = yazi_shared:: Xdg :: state_dir ( ) . join ( "schemes.toml" ) ;
15
+ // Ignore any errors, as it's fine to have an empty file.
16
+ let schemes_content = std:: fs:: read_to_string ( & schemes_path) . unwrap_or_default ( ) ;
17
+ toml:: from_str ( & schemes_content) . unwrap ( )
18
+ }
16
19
}
17
20
18
21
impl Schemes {
@@ -46,8 +49,8 @@ impl<'de> Deserialize<'de> for Schemes {
46
49
/// Scheme in configuration file.
47
50
#[ derive( Debug , Deserialize ) ]
48
51
pub struct Scheme {
49
- pub name : String ,
52
+ pub name : String ,
50
53
#[ serde( rename = "type" ) ]
51
- pub typ : String ,
54
+ pub typ : String ,
52
55
pub config : HashMap < String , String > ,
53
56
}
You can’t perform that action at this time.
0 commit comments