Skip to content

Commit

Permalink
Make cachedir platform specific
Browse files Browse the repository at this point in the history
  • Loading branch information
zoechi committed Feb 7, 2024
1 parent cfc6c2c commit a6bb858
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 14 deletions.
54 changes: 52 additions & 2 deletions Cargo.lock

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

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ edition = "2021"
[dependencies]
# xilem_core = { path = "../xilem/xilem/crates/xilem_core" }
xilem_core = { git = "https://github.com/Philipp-M/xilem.git", branch = "personal" }
anyhow = "1.0"
bitflags = "2.4"
crossterm = "0.27"
directories = "5.0"
kurbo = "0.10"
futures-task = "0.3"
futures-util = "0.3"
ratatui = "0.26"
tokio = { version = "1.35", features = ["full"] }
anyhow = "1.0"
tracing = "0.1.40"
tracing = "0.1"
tracing-appender = "0.2"
tracing-subscriber = "0.3"
kurbo = "0.10.4"
# update this when a new release occurs
ratatui = "0.26"
bitflags = "2.4.2"
unicode-segmentation = "1.10.1"
unicode-width = "0.1.11"
unicode-segmentation = "1.11"
unicode-width = "0.1"

[dev-dependencies]
futures = "0.3"
insta = "1.34.0"
rand = "0.8.5"
insta = "1.34"
rand = "0.8"

[lints.clippy]
dbg_macro = "warn"
6 changes: 4 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ use crossterm::{
};

use crossterm::event::{poll, read, Event as CxEvent, KeyCode, KeyEvent};
use directories::ProjectDirs;
use ratatui::Terminal;

#[cfg(not(test))]
use std::io::stdout;

use std::{collections::HashSet, path::PathBuf, sync::Arc, time::Duration};
use std::{collections::HashSet, sync::Arc, time::Duration};
use tokio::runtime::Runtime;
use tracing_subscriber::{fmt::writer::MakeWriterExt, layer::SubscriberExt, Registry};
use xilem_core::{AsyncWake, Id, IdPath, MessageResult};
Expand All @@ -40,7 +41,8 @@ use std::io::{Stdout, Write};

// TODO less hardcoding and cross-platform support
fn setup_logging(log_level: tracing::Level) -> Result<tracing_appender::non_blocking::WorkerGuard> {
let cache_dir = PathBuf::from(std::env::var_os("HOME").unwrap()).join(".cache/trui");
let proj_dirs = ProjectDirs::from("", "", "trui").expect("Opening cache directory");
let cache_dir = proj_dirs.cache_dir();
let tracing_file_appender = tracing_appender::rolling::never(cache_dir, "trui.log");
let (tracing_file_writer, guard) = tracing_appender::non_blocking(tracing_file_appender);

Expand Down

0 comments on commit a6bb858

Please sign in to comment.