logs
This commit is contained in:
parent
24054058ad
commit
6f3461730e
|
|
@ -27,6 +27,7 @@ fn main() {
|
|||
|
||||
tracing::info!(
|
||||
plugin_root = ?plugin_root,
|
||||
data_dir = ?layers::paths::data_dir(),
|
||||
log_dir = ?layers::paths::log_dir(),
|
||||
"layers shell: starting native event loop",
|
||||
);
|
||||
|
|
|
|||
13
src/paths.rs
13
src/paths.rs
|
|
@ -5,6 +5,7 @@ use sha2::{Digest, Sha256};
|
|||
|
||||
const PLUGIN_ID: &str = "com.jesshunter.layers";
|
||||
const KICAD_MAJOR_DIR: &str = "KiCad/10.0/plugins";
|
||||
const USER_DATA_DOTDIR: &str = ".layers";
|
||||
|
||||
pub fn plugin_data_dir() -> PathBuf {
|
||||
plugin_root()
|
||||
|
|
@ -14,8 +15,18 @@ pub fn plugin_dir() -> PathBuf {
|
|||
plugin_root()
|
||||
}
|
||||
|
||||
/// User-writable runtime data root: logs, state, cache, settings, runtime sockets.
|
||||
/// Decoupled from the plugin install location so a flatpak KiCad (which sandboxes
|
||||
/// its own data dirs) still writes somewhere we can `tail -f` from a normal shell.
|
||||
pub fn data_dir() -> PathBuf {
|
||||
plugin_root()
|
||||
if let Ok(v) = std::env::var("LAYERS_DATA_DIR") {
|
||||
if !v.is_empty() {
|
||||
return PathBuf::from(v);
|
||||
}
|
||||
}
|
||||
dirs::home_dir()
|
||||
.map(|h| h.join(USER_DATA_DOTDIR))
|
||||
.unwrap_or_else(|| PathBuf::from("/tmp").join(USER_DATA_DOTDIR))
|
||||
}
|
||||
|
||||
pub fn state_dir() -> PathBuf {
|
||||
|
|
|
|||
Loading…
Reference in New Issue