Fix cache bug

This commit is contained in:
Xyon 2023-09-20 23:22:30 +01:00
parent be130790ea
commit 0b2e2bcb4a
Signed by: xyon
GPG Key ID: DD18155D6B18078D
1 changed files with 3 additions and 2 deletions

View File

@ -1,3 +1,4 @@
use std::env::temp_dir;
use std::fmt::Debug; use std::fmt::Debug;
use std::fs; use std::fs;
use std::path::PathBuf; use std::path::PathBuf;
@ -38,8 +39,7 @@ impl FuelTank {
U: DeserializeOwned, U: Pump<T> U: DeserializeOwned, U: Pump<T>
{ {
let path = PathBuf::new() let path = PathBuf::new()
.join(home_dir().ok_or(ManifoldError::from("No home dir"))?) .join(temp_dir())
.join(".local")
.join(format!("manifold-{}-cache-{}.json", self.cache_name.clone().unwrap(), CACHE_VERSION)); .join(format!("manifold-{}-cache-{}.json", self.cache_name.clone().unwrap(), CACHE_VERSION));
let mut fuel = match self.cache_mode { let mut fuel = match self.cache_mode {
@ -50,6 +50,7 @@ impl FuelTank {
debug!("Cache path: {:?}", &path); debug!("Cache path: {:?}", &path);
fs::OpenOptions::new() fs::OpenOptions::new()
.read(true) .read(true)
.write(true)
.create(true) .create(true)
.open(&path) .open(&path)
.map_err(|e| { .map_err(|e| {