-
Notifications
You must be signed in to change notification settings - Fork 110
Description
These typedef and build target directories are hardcoded to be in ~/.lune/
.
lune/crates/lune/src/cli/setup.rs
Lines 171 to 176 in 5d1401c
let cache_dir = UserDirs::new() | |
.context("Failed to find user home directory")? | |
.home_dir() | |
.join(".lune") | |
.join(".typedefs") | |
.join(version_string); |
lune/crates/lune/src/cli/build/target.rs
Line 13 in 5d1401c
pub static CACHE_DIR: Lazy<PathBuf> = Lazy::new(|| HOME_DIR.join(".lune").join("target")); |
And the REPL history file is hardcoded at ~/.lune_history
.
lune/crates/lune/src/cli/repl.rs
Lines 26 to 29 in 5d1401c
let history_file_path: &PathBuf = &UserDirs::new() | |
.context("Failed to find user home directory")? | |
.home_dir() | |
.join(".lune_history"); |
The directories
crate in use in Lune at the moment can support XDG_* environment variables, but only does so on Linux - this means macOS users would not have their preferences respected. I made my own user_dirs
crate as an alternative that solves that issue of XDG on macOS not being respected, and there is the slightly more well known etcetera library that does so as well. I'm sure there are others I'm not aware of, and it isn't too complicated to implement this in-house in this repository.
Ideally the typedef/build files would be cached in $XDG_CACHE_HOME/lune/
, and the REPL history file at $XDG_STATE_HOME/lune/lune_history
(following fish shell's lead here of $XDG_STATE_HOME/fish/fish_history
fwiw). These locations could default back to the current hardcoded paths if the XDG_* variables are not present.
It also may be worth considering LUNE_CACHE
and LUNE_HISTORY
environment variables, for setting the cache directory and history file paths respectfully, as some other programs do. I have no opinion on the matter but it is worth mentioning when bringing up this topic.