-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpaths.rs
More file actions
51 lines (42 loc) · 1.37 KB
/
Copy pathpaths.rs
File metadata and controls
51 lines (42 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use std::{env, path::PathBuf};
fn repo_root() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("..")
.join("..")
.canonicalize()
.unwrap_or_else(|_| {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("..")
.join("..")
})
}
fn launchdeck_local_root_dir() -> PathBuf {
if let Ok(explicit) = env::var("LAUNCHDECK_LOCAL_DATA_DIR") {
let trimmed = explicit.trim();
if !trimmed.is_empty() {
return PathBuf::from(trimmed);
}
}
repo_root().join(".local").join("launchdeck")
}
fn launchdeck_shared_lookup_table_cache_path() -> PathBuf {
launchdeck_local_root_dir().join("shared-lookup-tables.json")
}
pub fn shared_lookup_table_cache_path() -> PathBuf {
launchdeck_shared_lookup_table_cache_path()
}
pub fn shared_fee_market_cache_path() -> PathBuf {
launchdeck_local_root_dir().join("shared-fee-market.json")
}
pub fn legacy_bonk_lookup_table_cache_path() -> PathBuf {
launchdeck_local_root_dir().join("bonk-lookup-tables.json")
}
pub fn bonk_lookup_table_cache_path() -> PathBuf {
launchdeck_shared_lookup_table_cache_path()
}
pub fn bags_credentials_path() -> PathBuf {
launchdeck_local_root_dir().join("bags-credentials.json")
}
pub fn bags_session_path() -> PathBuf {
launchdeck_local_root_dir().join("bags-session.json")
}