diff --git a/src/analysis/entities.rs b/src/analysis/entities.rs index 21dde80..b6c4f99 100644 --- a/src/analysis/entities.rs +++ b/src/analysis/entities.rs @@ -91,10 +91,15 @@ impl EntityExtractor { // Pattern 2: Extract from path if text.contains('/') || text.contains('\\') { let parts: Vec<&str> = text.split(&['/', '\\'][..]).collect(); - // Find directory name before filename - if parts.len() >= 2 { - let potential_project = parts[parts.len() - 2]; - if !potential_project.is_empty() && potential_project.len() > 2 { + // Common directory names to skip (not project names) + let skip_dirs = ["src", "lib", "bin", "tests", "test", "examples", "target", "build", "dist", "node_modules"]; + + // Find directory name before filename, skipping common directories + for i in (0..parts.len().saturating_sub(1)).rev() { + let potential_project = parts[i]; + if !potential_project.is_empty() + && potential_project.len() > 2 + && !skip_dirs.contains(&potential_project.to_lowercase().as_str()) { return Some(potential_project.to_string()); } } diff --git a/src/capture/window.rs b/src/capture/window.rs index 3aac4f9..6c340a4 100644 --- a/src/capture/window.rs +++ b/src/capture/window.rs @@ -1,11 +1,13 @@ /// Window metadata extraction (Windows uniquement) use serde::{Deserialize, Serialize}; -use crate::error::{AppError, Result}; +use crate::error::Result; + +#[cfg(not(windows))] +use crate::error::AppError; #[cfg(windows)] use windows::{ - core::PWSTR, - Win32::Foundation::{HWND, MAX_PATH}, + Win32::Foundation::MAX_PATH, Win32::System::ProcessStatus::GetModuleBaseNameW, Win32::System::Threading::{OpenProcess, PROCESS_QUERY_INFORMATION, PROCESS_VM_READ}, Win32::UI::WindowsAndMessaging::{GetForegroundWindow, GetWindowTextW, GetWindowThreadProcessId}, diff --git a/src/storage/database.rs b/src/storage/database.rs index ccec299..ad4757a 100644 --- a/src/storage/database.rs +++ b/src/storage/database.rs @@ -284,7 +284,6 @@ impl Database { mod tests { use super::*; use tempfile::NamedTempFile; - use chrono::Duration; #[test] fn test_database_creation() {