Repository: PaddiM8/kalker (language: rust)

Issue:
kalker doesn't follow XDG specification
the file `history.txt` should be inside `XDG_DATA_HOME` or `XDG_CACHE_HOME`, but not `XDG_CONFIG_HOME`.

So... not `.config/kalker/history.txt` as is not a configuration file. Instead it should be inside `.cache` or `.local/share` (not sure about this, but probably .cache)
kalker doesn't follow XDG specification
the file `history.txt` should be inside `XDG_DATA_HOME` or `XDG_CACHE_HOME`, but not `XDG_CONFIG_HOME`.

So... not `.config/kalker/history.txt` as is not a configuration file. Instead it should be inside `.cache` or `.local/share` (not sure about this, but probably .cache)


Discussion / hints:
Yeah I think XDG_CACHE_HOME will be good.
Yeah I think XDG_CACHE_HOME will be good.

Fix patch:
diff --git a/cli/src/repl.rs b/cli/src/repl.rs
index 1cf8fb0..94e4f6a 100644
--- a/cli/src/repl.rs
+++ b/cli/src/repl.rs
@@ -34,12 +34,12 @@ pub fn start(parser: &mut parser::Context, precision: u32) {
 
     // Load history
     let mut history_path = None;
-    if let Some(config_path) = dirs::config_dir() {
-        let mut config_path = config_path;
-        config_path.push("kalker");
-        if fs::create_dir_all(config_path.as_path()).is_ok() {
-            config_path.push("history.txt");
-            let history = config_path.into_os_string().into_string().unwrap();
+    if let Some(cache_path) = dirs::cache_dir() {
+        let mut cache_path = cache_path;
+        cache_path.push("kalker");
+        if fs::create_dir_all(cache_path.as_path()).is_ok() {
+            cache_path.push("history.txt");
+            let history = cache_path.into_os_string().into_string().unwrap();
             editor.load_history(&history).ok();
             history_path = Some(history)
         }


Test patch: