Repository: xen0n/autojump-rs (language: rust)

Issue:
Consistent behavior when XDG_DATA_HOME is specified
Currently, when the environment variable XDG_DATA_HOME is not
specified, autojump-rs puts its data files under
~/.local/share/autojump/..., but if it is specified, it puts it into
the directory directly - no autojump folder is created.

I feel this behavior is inconsistent, because it does different things
when the data home is set to its default value, ~/.local/share.

I think we should always use a separate directory for autojump inside
whatever data directory is specified.


Discussion / hints:

Fix patch:
diff --git a/src/config/mod.rs b/src/config/mod.rs
index c09b5dd..929a010 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -35,7 +35,9 @@ fn data_home() -> path::PathBuf {
     use std::env;
     // Use $XDG_DATA_HOME if defined, ~/.local/share/autojump otherwise.
     if let Some(home_s) = env::var_os("XDG_DATA_HOME") {
-        path::PathBuf::from(home_s)
+         let mut tmp = path::PathBuf::from(home_s);
+         tmp.push("autojump");
+         tmp
     } else {
         xdg_home_hardcoded()
     }


Test patch: