Skip to content

Commit

Permalink
Merge pull request #81 from tek/tek/db-dir
Browse files Browse the repository at this point in the history
Use $NIX_INDEX_DATABASE/files if the var contains a directory
  • Loading branch information
Artturin authored Nov 1, 2024
2 parents 85e9330 + d9e6231 commit 10e4dcc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ pub fn check_database_updated() {
/// Get the location of the nix-index database file
fn get_database_file() -> PathBuf {
match env::var("NIX_INDEX_DATABASE") {
Ok(db) => PathBuf::from(db),
Ok(db) => {
let path = PathBuf::from(db);
return if path.is_dir() { path.join("files") } else { path };
},
Err(_) => {
let base = xdg::BaseDirectories::with_prefix("nix-index").unwrap();
let cache_dir = base.get_cache_home();
Expand Down

0 comments on commit 10e4dcc

Please sign in to comment.