aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-02-19 01:25:40 -0500
committerJesse Luehrs <doy@tozt.net>2021-02-19 02:09:16 -0500
commit0986163d9d7f4ee4d3f499ae976ef669193eb842 (patch)
treed169bf68eb0f3d2ef028fe8075e6643d0445e3d3
parentda23c16ecb7bdbfe950d87001104d913ec08c09a (diff)
downloadrbw-0986163d9d7f4ee4d3f499ae976ef669193eb842.tar.gz
rbw-0986163d9d7f4ee4d3f499ae976ef669193eb842.zip
respect TMPDIR for the fallback runtime dir
-rw-r--r--CHANGELOG.md6
-rw-r--r--src/dirs.rs7
2 files changed, 12 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4cdab14..6dd5e7a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog
+## [Unreleased]
+
+### Fixed
+
+* Stop hardcoding /tmp when using the fallback runtime directory (#37, pschmitt)
+
## [0.5.2] - 2020-12-02
### Fixed
diff --git a/src/dirs.rs b/src/dirs.rs
index 16ce29a..cde00e3 100644
--- a/src/dirs.rs
+++ b/src/dirs.rs
@@ -73,6 +73,11 @@ fn runtime_dir() -> std::path::PathBuf {
let project_dirs = directories::ProjectDirs::from("", "", "rbw").unwrap();
match project_dirs.runtime_dir() {
Some(dir) => dir.to_path_buf(),
- None => format!("/tmp/rbw-{}", nix::unistd::getuid().as_raw()).into(),
+ None => format!(
+ "{}/rbw-{}",
+ std::env::temp_dir().to_string_lossy(),
+ nix::unistd::getuid().as_raw()
+ )
+ .into(),
}
}