File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -208,6 +208,7 @@ fn session_root(config_dir: &Path) -> PathBuf {
208208}
209209
210210async fn run_editor_inner ( args : Args ) -> anyhow:: Result < ( ) > {
211+ fs:: create_dir_all ( Config :: config_dir ( ) ) ?;
211212 let config_file = Config :: path ( "config.toml" ) ;
212213 let preferences_file = Config :: path ( "preferences.json" ) ;
213214 let first_launch = !config_file. exists ( ) && !preferences_file. exists ( ) ;
Original file line number Diff line number Diff line change 1+ use std:: process:: Command ;
2+
3+ #[ test]
4+ fn first_launch_creates_config_directory_before_opening_default_log ( ) {
5+ let config_home = tempfile:: tempdir ( ) . unwrap ( ) ;
6+ let config_dir = config_home. path ( ) . join ( "red" ) ;
7+
8+ // A non-terminal run stops at raw-mode setup, after runtime config has loaded.
9+ Command :: new ( env ! ( "CARGO_BIN_EXE_red" ) )
10+ . env ( "XDG_CONFIG_HOME" , config_home. path ( ) )
11+ . output ( )
12+ . unwrap ( ) ;
13+
14+ assert ! ( config_dir. join( "red.log" ) . is_file( ) ) ;
15+ assert ! ( !config_dir. join( "config.toml" ) . exists( ) ) ;
16+ }
You can’t perform that action at this time.
0 commit comments