This commit is contained in:
parent
b115b91ecb
commit
e4eb85f535
7 changed files with 75 additions and 38 deletions
|
@ -1,4 +1,5 @@
|
|||
use std::path::PathBuf;
|
||||
use crate::CONFIG;
|
||||
|
||||
pub struct TempDir {
|
||||
path: PathBuf,
|
||||
|
@ -20,9 +21,11 @@ impl TempDir {
|
|||
impl Default for TempDir {
|
||||
fn default() -> TempDir {
|
||||
TempDir::new({
|
||||
let mut t = std::env::temp_dir();
|
||||
t.push("pkgr");
|
||||
t
|
||||
if let Some(d) = CONFIG.with(|c| c.tmp_dir.clone()) {
|
||||
PathBuf::from(d)
|
||||
} else {
|
||||
PathBuf::from("/tmp/pkgr")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue