summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyohei Uto <im@kyoheiu.dev>2022-11-12 16:08:32 +0900
committerGitHub <noreply@github.com>2022-11-12 16:08:32 +0900
commitdbf632c790f678d6ee56efbf116acd8e684d012c (patch)
treed1322f2e1840268b7fa05cab41d38e7fc9d33bd1
parent51808b831229f5cd2588537dc4445dbf8638d718 (diff)
parent45d1ec03b9e82bb300ef02a4dabdbea07de7f030 (diff)
Merge pull request #143 from kyoheiu/developv2.0.1
v2.0.1
-rw-r--r--CHANGELOG.md7
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml4
-rw-r--r--README.md7
-rw-r--r--config.yaml2
-rw-r--r--src/config.rs12
-rw-r--r--src/help.rs2
-rw-r--r--src/state.rs2
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
diff --git a/Cargo.lock b/Cargo.lock
index 6942e1a..563dba3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -199,7 +199,7 @@ dependencies = [
[[package]]
name = "felix"
-version = "2.0.0"
+version = "2.0.1"
dependencies = [
"chrono",
"content_inspector",
diff --git a/Cargo.toml b/Cargo.toml
index e77cb47..121447c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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]
diff --git a/README.md b/README.md
index 54fd898..fa6aced 100644
--- a/README.md
+++ b/README.md
@@ -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(),