summaryrefslogtreecommitdiffstats
path: root/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/build.rs b/build.rs
index 3157f934..b5ae01c1 100644
--- a/build.rs
+++ b/build.rs
@@ -20,4 +20,23 @@ fn main() {
Ok(_) => (),
Err(e) => eprintln!("{e:?}"),
}
+
+ update_breaking_config()
+}
+
+/// Remove old binds from user config file.
+///
+/// Remove all binds to `Jump` and `Mocp...` variants since they were removed from fm.
+fn update_breaking_config() {
+ let config = shellexpand::tilde("~/.config/fm/config.yaml");
+ let config: &str = config.borrow();
+ let content = std::fs::read_to_string(config)
+ .expect("config file should be readable")
+ .lines()
+ .map(String::from)
+ .filter(|line| !line.contains("Jump"))
+ .filter(|line| !line.contains("Mocp"))
+ .collect::<Vec<String>>()
+ .join("\n");
+ std::fs::write(config, &content).expect("config should be writabe");
}