diff options
author | Kyohei Uto <im@kyoheiu.dev> | 2022-11-12 16:08:32 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-12 16:08:32 +0900 |
commit | dbf632c790f678d6ee56efbf116acd8e684d012c (patch) | |
tree | d1322f2e1840268b7fa05cab41d38e7fc9d33bd1 | |
parent | 51808b831229f5cd2588537dc4445dbf8638d718 (diff) | |
parent | 45d1ec03b9e82bb300ef02a4dabdbea07de7f030 (diff) |
Merge pull request #143 from kyoheiu/developv2.0.1
v2.0.1
-rw-r--r-- | CHANGELOG.md | 7 | ||||
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 4 | ||||
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | config.yaml | 2 | ||||
-rw-r--r-- | src/config.rs | 12 | ||||
-rw-r--r-- | src/help.rs | 2 | ||||
-rw-r--r-- | src/state.rs | 2 |
8 files changed, 27 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index d63f6c8..a6e5620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ ## Unreleased +## v2.0.1 (2022-11-12) + +### Fixed + +- Fixed the bug in making config at the launch. +- Fixed the config file path on macOS. + ## v2.0.0 (2022-11-11) ### Changed @@ -199,7 +199,7 @@ dependencies = [ [[package]] name = "felix" -version = "2.0.0" +version = "2.0.1" dependencies = [ "chrono", "content_inspector", @@ -1,6 +1,6 @@ [package] name = "felix" -version = "2.0.0" +version = "2.0.1" authors = ["Kyohei Uto <im@kyoheiu.dev>"] edition = "2021" description = "tui file manager with vim-like key mapping" @@ -24,7 +24,7 @@ log = "0.4.16" simplelog = "0.12.0" content_inspector = "0.2.4" crossterm = "0.25.0" -syntect = {git = "https://github.com/kyoheiu/syntect"} +syntect = {version = "5.0.0", git = "https://github.com/kyoheiu/syntect"} serde_yaml = "0.9.14" [dependencies.serde] @@ -11,6 +11,13 @@ For the detailed document, please see https://kyoheiu.dev/felix. ## New Release +## v2.0.1 (2022-11-12) bugfix + +### Fixed + +- Fixed the bug in making config at the launch. +- Fixed the config file path on macOS. + ## v2.0.0 (2022-11-11) ### Changed diff --git a/config.yaml b/config.yaml index d81afc7..5b3070b 100644 --- a/config.yaml +++ b/config.yaml @@ -1,4 +1,4 @@ -# v2.0.0 +# v2.0.1 # (Optional) # Default exec command when open files. diff --git a/src/config.rs b/src/config.rs index 7da87c2..a28bbaf 100644 --- a/src/config.rs +++ b/src/config.rs @@ -177,7 +177,8 @@ pub fn make_config_if_not_exists(config_file: &Path, trash_dir: &Path) -> Result std::io::stdin().read_line(&mut buffer)?; trimmed = buffer.trim(); } - let config = CONFIG_EXAMPLE.replace("# default: nvim", trimmed); + let config = + CONFIG_EXAMPLE.replace("# default: nvim", &format!("default: {}", trimmed)); std::fs::write(&config_file, config) .unwrap_or_else(|_| panic!("cannot write new config file.")); println!( @@ -203,11 +204,12 @@ pub fn make_config_if_not_exists(config_file: &Path, trash_dir: &Path) -> Result } fn config_file_path() -> String { - if cfg!(target_os = "mac_os") { - "~/Library/Application Support/felix/config.yaml".to_owned() - } else if cfg!(target_os = "windows") { + if cfg!(target_os = "windows") { "~\\AppData\\Roaming\\felix\\config.yaml".to_owned() } else { - "~/.config/felix/config.yaml".to_owned() + let mut config = dirs::config_dir().unwrap_or_else(|| panic!("Cannot read config dir.")); + config.push(FX_CONFIG_DIR); + config.push(CONFIG_FILE); + config.to_str().unwrap().to_string() } } diff --git a/src/help.rs b/src/help.rs index 5c46594..9509caa 100644 --- a/src/help.rs +++ b/src/help.rs @@ -1,5 +1,5 @@ /// Help text. -pub const HELP: &str = "# felix v2.0.0 +pub const HELP: &str = "# felix v2.0.1 A simple TUI file manager with vim-like keymapping. ## Usage diff --git a/src/state.rs b/src/state.rs index 60d2e88..0b68eca 100644 --- a/src/state.rs +++ b/src/state.rs @@ -130,7 +130,7 @@ impl State { trash_dir: PathBuf::new(), default: config .default - .unwrap_or_else(|| env::var("EDITOR").expect("Falling back to env var")), + .unwrap_or_else(|| env::var("EDITOR").unwrap_or_default()), commands: to_extension_map(&config.exec), layout: Layout { nums: Num::new(), |