mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-09-02 01:29:23 +00:00
feat: add IRONCLAW_BASE_DIR env var with LazyLock caching (#397)
This commit is contained in:
@@ -14,6 +14,7 @@ use async_trait::async_trait;
|
||||
use chrono::Utc;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::bootstrap::ironclaw_base_dir;
|
||||
use crate::channels::IncomingMessage;
|
||||
use crate::channels::web::types::SseEvent;
|
||||
use crate::context::{ContextManager, JobContext, JobState};
|
||||
@@ -554,10 +555,7 @@ fn validate_env_var_name(name: &str) -> Result<(), ToolError> {
|
||||
}
|
||||
|
||||
fn projects_base() -> PathBuf {
|
||||
dirs::home_dir()
|
||||
.unwrap_or_else(|| PathBuf::from("."))
|
||||
.join(".ironclaw")
|
||||
.join("projects")
|
||||
ironclaw_base_dir().join("projects")
|
||||
}
|
||||
|
||||
/// Resolve the project directory, creating it if it doesn't exist.
|
||||
|
||||
@@ -8,6 +8,7 @@ use std::sync::Arc;
|
||||
use async_trait::async_trait;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
use crate::bootstrap::ironclaw_base_dir;
|
||||
use crate::channels::{ChannelManager, OutgoingResponse};
|
||||
use crate::context::JobContext;
|
||||
use crate::tools::tool::{
|
||||
@@ -27,9 +28,7 @@ pub struct MessageTool {
|
||||
|
||||
impl MessageTool {
|
||||
pub fn new(channel_manager: Arc<ChannelManager>) -> Self {
|
||||
let base_dir = dirs::home_dir()
|
||||
.unwrap_or_else(|| std::path::PathBuf::from("."))
|
||||
.join(".ironclaw");
|
||||
let base_dir = ironclaw_base_dir();
|
||||
|
||||
Self {
|
||||
channel_manager,
|
||||
|
||||
Reference in New Issue
Block a user