Skip to content

Commit

Permalink
fix(utils): fix build on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
cathaysia committed Sep 11, 2023
1 parent 5e0f92e commit e38210d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 39 deletions.
32 changes: 0 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ futures = "0.3.28"
anyhow = "1.0.75"
nixpkgs-fmt = "1.3.0"
redb = "1.1.0"
standard_paths = "2.1.0"
15 changes: 9 additions & 6 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use std::path::PathBuf;

use redb::{ReadableTable, TableDefinition};
use standard_paths::{LocationType, StandardPaths};

pub static CACHER: std::sync::LazyLock<redb::Database> = std::sync::LazyLock::new(|| {
let path = StandardPaths::new("nix4vscode", "cathaysia");
let path = path
.writable_location(LocationType::GenericCacheLocation)
.unwrap();
let path = path.join("nix4vscode");
let path = format!(
"{}/{}/{}",
std::env::var("HOME").unwrap(),
".cache",
"nix4vscode"
);
let path = PathBuf::from(path);
if !path.exists() {
std::fs::create_dir_all(path.clone()).unwrap();
}
Expand Down

0 comments on commit e38210d

Please sign in to comment.