@@ -8,13 +8,11 @@ mod ui;
88
99use application::Application;
1010
11−use helix_core::config_dir;
12−
1311use std::path::PathBuf;
1412
1513use anyhow::{Context, Error, Result};
1614
17−fn setup_logging(verbosity: u64) -> Result<()> {
15+fn setup_logging(logpath: PathBuf, verbosity: u64) -> Result<()> {
1816 let mut base_config = fern::Dispatch::new();
1917
2018 // Let's say we depend on something which whose "info" level messages are too
@@ -40,7 +38,7 @@ fn setup_logging(verbosity: u64) -> Result<()> {
4038 message
4139 ))
4240 })
43− .chain(fern::log_file(config_dir().join("helix.log"))?);
41+ .chain(fern::log_file(logpath)?);
4442
4543 base_config.chain(file_config).apply()?;
4644
@@ -96,6 +94,12 @@ fn parse_args(mut args: Args) -> Result<Args> {
9694
9795#[tokio::main]
9896async fn main() -> Result<()> {
97+ let cache_dir = helix_core::cache_dir();
98+ if !cache_dir.exists() {
99+ std::fs::create_dir(&cache_dir);
100+ }
101+
102+ let logpath = cache_dir.join("helix.log");
99103 let help = format!(
100104 "\
101105{} {}
@@ -111,12 +115,14 @@ ARGS:
111115FLAGS:
112116 -h, --help Prints help information
113117 -v Increases logging verbosity each use for up to 3 times
118+ (default file: {})
114119 -V, --version Prints version information
115120",
116121 env!("CARGO_PKG_NAME"),
117122 env!("CARGO_PKG_VERSION"),
118123 env!("CARGO_PKG_AUTHORS"),
119124 env!("CARGO_PKG_DESCRIPTION"),
125+ logpath.display(),
120126 );
121127
122128 let mut args: Args = Args {
@@ -139,19 +145,18 @@ FLAGS:
139145 std::process::exit(0);
140146 }
141147
142− let conf_dir = config_dir();
143−
148+ let conf_dir = helix_core::config_dir();
144149 if !conf_dir.exists() {
145150 std::fs::create_dir(&conf_dir);
146151 }
147152
148− setup_logging(args.verbosity).context("failed to initialize logging")?;
153+ setup_logging(logpath, args.verbosity).context("failed to initialize logging")?;
149154
150155 // initialize language registry
151156 use helix_core::syntax::{Loader, LOADER};
152157
153158 // load $HOME/.config/helix/languages.toml, fallback to default config
154− let config = std::fs::read(config_dir().join("languages.toml"));
159+ let config = std::fs::read(helix_core::config_dir().join("languages.toml"));
155160 let toml = config
156161 .as_deref()
157162 .unwrap_or(include_bytes!("../../languages.toml"));