mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-07 20:59:09 -07:00
global: snapshot
This commit is contained in:
3
crates/brk_core/src/utils/checked_sub.rs
Normal file
3
crates/brk_core/src/utils/checked_sub.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub trait CheckedSub<Rhs = Self>: Sized {
|
||||
fn checked_sub(self, rhs: Rhs) -> Option<Self>;
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
mod checked_sub;
|
||||
mod paths;
|
||||
mod pause;
|
||||
mod rlimit;
|
||||
|
||||
pub use checked_sub::*;
|
||||
pub use paths::*;
|
||||
pub use pause::*;
|
||||
pub use rlimit::*;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{
|
||||
env,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
pub fn path_dot_brk() -> PathBuf {
|
||||
let home = std::env::var("HOME").unwrap();
|
||||
@@ -8,3 +11,26 @@ pub fn path_dot_brk() -> PathBuf {
|
||||
pub fn path_dot_brk_log() -> PathBuf {
|
||||
path_dot_brk().join("log")
|
||||
}
|
||||
|
||||
pub fn default_brk() -> PathBuf {
|
||||
path_dot_brk()
|
||||
}
|
||||
|
||||
pub fn default_bitcoin_path() -> PathBuf {
|
||||
if env::consts::OS == "macos" {
|
||||
default_mac_bitcoin_path()
|
||||
} else {
|
||||
default_linux_bitcoin_path()
|
||||
}
|
||||
}
|
||||
|
||||
fn default_linux_bitcoin_path() -> PathBuf {
|
||||
Path::new(&std::env::var("HOME").unwrap()).join(".bitcoin")
|
||||
}
|
||||
|
||||
fn default_mac_bitcoin_path() -> PathBuf {
|
||||
Path::new(&std::env::var("HOME").unwrap())
|
||||
.join("Library")
|
||||
.join("Application Support")
|
||||
.join("Bitcoin")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user