GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git
Support loading and saving keybindings to keybinds.kdl
src/config.rs | 4 ++++
src/widget/input/keybinds_control.rs | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/config.rs b/src/config.rs
index dcfd83c..75ee8ac 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -374,6 +374,10 @@ pub fn get_config_path() -> std::path::PathBuf {
dir.join("cce").join("config.kdl")
}
+pub fn get_keybinds_path() -> std::path::PathBuf {
+ get_config_path().parent().unwrap().to_path_buf().join("keybinds.kdl")
+}
+
fn perform_rolling_backup(path: &str) {
let config_path = get_config_path();
if std::path::Path::new(path) != config_path {
diff --git a/src/widget/input/keybinds_control.rs b/src/widget/input/keybinds_control.rs
index 0ce9dd4..e2862d9 100644
--- a/src/widget/input/keybinds_control.rs
+++ b/src/widget/input/keybinds_control.rs
@@ -53,7 +53,7 @@ impl KeybindsControl {
}
pub fn load_from_config(&mut self) {
- let path = crate::config::get_config_path();
+ let path = crate::config::get_keybinds_path();
let content = std::fs::read_to_string(&path).unwrap_or_default();
let val = crate::config::parse_kdl_to_json(&content);
let mut loaded = Vec::new();
@@ -104,7 +104,7 @@ impl KeybindsControl {
}
pub fn save_to_config(&self) {
- let path = crate::config::get_config_path();
+ let path = crate::config::get_keybinds_path();
if let Some(parent) = path.parent() {
let _ = std::fs::create_dir_all(parent);
}