diff --git a/nvim-core/src/lib.rs b/nvim-core/src/lib.rs index 5bc47ae..0d84ffe 100644 --- a/nvim-core/src/lib.rs +++ b/nvim-core/src/lib.rs @@ -99,7 +99,7 @@ async fn get_socket_path() -> Result { std::env::var("USERPROFILE").unwrap_or_else(|_| "C:\\Users\\reazul.ashraf".into()); let path = format!("{}\\.gemini\\active_nvim.txt", profile); - if let Ok(content) = std::fs::read_to_string(&path) { + if let Ok(content) = tokio::fs::read_to_string(&path).await { let p = content.trim().to_string(); if !p.is_empty() { if p.starts_with(r"\\.\pipe\") { @@ -113,8 +113,8 @@ async fn get_socket_path() -> Result { } tracing::warn!("active_nvim.txt missing or invalid, falling back to pipe discovery"); - if let Ok(dir) = std::fs::read_dir(r"\\.\pipe\") { - for entry in dir.flatten() { + if let Ok(mut dir) = tokio::fs::read_dir(r"\\.\pipe\").await { + while let Ok(Some(entry)) = dir.next_entry().await { let name = entry.file_name(); let name_str = name.to_string_lossy(); if name_str.starts_with("nvim.") { @@ -129,7 +129,7 @@ async fn get_socket_path() -> Result { async fn get_socket_path() -> Result { if let Ok(home) = std::env::var("HOME") { let path = format!("{}/.gemini/active_nvim.txt", home); - if let Ok(content) = std::fs::read_to_string(&path) { + if let Ok(content) = tokio::fs::read_to_string(&path).await { let p = content.trim().to_string(); if !p.is_empty() { return Ok(p); @@ -137,12 +137,12 @@ async fn get_socket_path() -> Result { } } - if let Ok(entries) = std::fs::read_dir("/tmp") { - for entry in entries.flatten() { + if let Ok(mut entries) = tokio::fs::read_dir("/tmp").await { + while let Ok(Some(entry)) = entries.next_entry().await { if let Ok(name) = entry.file_name().into_string() { if name.starts_with("nvim.") { let path = entry.path().join("0"); - if path.exists() { + if tokio::fs::try_exists(&path).await.unwrap_or(false) { return Ok(path.to_string_lossy().to_string()); } }