on master help sign in
Merge pull request #50 from wojciechkepka/config
0a6672cBlaž Hrastnik
helix-term/src/main.rs+9−4
@@ -8,6 +8,8 @@ mod ui;
8
8
9use application::Application;
9use application::Application;
10
10
11+use helix_core::config_dir;
12+
11use std::path::PathBuf;
13use std::path::PathBuf;
12
14
13use anyhow::{Context, Result};
15use anyhow::{Context, Result};
@@ -27,8 +29,6 @@ fn setup_logging(verbosity: u64) -> Result<()> {
27 _3_or_more => base_config.level(log::LevelFilter::Trace),
29 _3_or_more => base_config.level(log::LevelFilter::Trace),
28 };
30 };
29
31
30− let home = dirs_next::home_dir().context("can't find the home directory")?;
31−
32 // Separate file config so we can include year, month and day in file logs
32 // Separate file config so we can include year, month and day in file logs
33 let file_config = fern::Dispatch::new()
33 let file_config = fern::Dispatch::new()
34 .format(|out, message, record| {
34 .format(|out, message, record| {
@@ -40,7 +40,7 @@ fn setup_logging(verbosity: u64) -> Result<()> {
40 message
40 message
41 ))
41 ))
42 })
42 })
43− .chain(fern::log_file(home.join("helix.log"))?);
43+ .chain(fern::log_file(config_dir().join("helix.log"))?);
44
44
45 base_config.chain(file_config).apply()?;
45 base_config.chain(file_config).apply()?;
46
46
@@ -89,6 +89,12 @@ FLAGS:
89 verbosity = 1;
89 verbosity = 1;
90 }
90 }
91
91
92+ let conf_dir = config_dir();
93+
94+ if !conf_dir.exists() {
95+ std::fs::create_dir(&conf_dir);
96+ }
97+
92 setup_logging(verbosity).context("failed to initialize logging")?;
98 setup_logging(verbosity).context("failed to initialize logging")?;
93
99
94 let args = Args {
100 let args = Args {
@@ -96,7 +102,6 @@ FLAGS:
96 };
102 };
97
103
98 // initialize language registry
104 // initialize language registry
99− use helix_core::config_dir;
100 use helix_core::syntax::{Loader, LOADER};
105 use helix_core::syntax::{Loader, LOADER};
101
106
102 // load $HOME/.config/helix/languages.toml, fallback to default config
107 // load $HOME/.config/helix/languages.toml, fallback to default config