summaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2020-09-30 22:53:54 -0400
committerGitHub <noreply@github.com>2020-09-30 22:53:54 -0400
commit5b33e8d6b4b28c6a64e017bc137bd4897cf9cb74 (patch)
tree8d0aa970879784f38e4c5724f6101e2a1109302c /src/bin
parent9afb6d7c88ca515ecd8d37134b567b6d17e0f0fb (diff)
Use tmp_dir rather than /tmp/ (#260)
Uses a less hard-coded method of writing to /tmp/.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/main.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs
index d8e541cd..81ac2041 100644
--- a/src/bin/main.rs
+++ b/src/bin/main.rs
@@ -7,6 +7,7 @@ use bottom::{canvas, constants::*, data_conversion::*, options::*, *};
use std::{
boxed::Box,
+ ffi::OsStr,
io::{stdout, Write},
panic,
sync::{
@@ -29,11 +30,13 @@ fn main() -> Result<()> {
let matches = clap::get_matches();
let is_debug = matches.is_present("debug");
if is_debug {
- utils::logging::init_logger(log::LevelFilter::Trace, "/tmp/bottom_debug.log")?;
+ let mut tmp_dir = std::env::temp_dir();
+ tmp_dir.push("bottom_debug.log");
+ utils::logging::init_logger(log::LevelFilter::Trace, tmp_dir.as_os_str())?;
} else {
#[cfg(debug_assertions)]
{
- utils::logging::init_logger(log::LevelFilter::Debug, "debug.log")?;
+ utils::logging::init_logger(log::LevelFilter::Debug, OsStr::new("debug.log"))?;
}
}