Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: ignore hidden dir in pipes

Louis Beaumont986e0ca46f19
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index d82fd2592..24d1abd60 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.4.1"
+version = "0.4.2"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-core/src/pipes.rs b/screenpipe-core/src/pipes.rs
index 39f57068d..a41f1c2fe 100644
--- a/screenpipe-core/src/pipes.rs
+++ b/screenpipe-core/src/pipes.rs
@@ -10,6 +10,7 @@ mod pipes {
use anyhow::Result;
use reqwest;
+ use std::fs;
use std::future::Future;
use std::path::Path;
use std::pin::Pin;
@@ -155,12 +156,18 @@ mod pipes {
while let Some(entry) = entries.next_entry().await? {
let ty = entry.file_type().await?;
let src_path = entry.path();
- let dst_path = dst.as_ref().join(entry.file_name());
+ let file_name = entry.file_name();
+
+ if !is_hidden_file(&file_name) {
+ let dst_path = dst.as_ref().join(&file_name);
- if ty.is_dir() {
- copy_dir_all_boxed(src_path, dst_path).await?;
+ if ty.is_dir() {
+ copy_dir_all_boxed(src_path, dst_path).await?;
+ } else {
+ tokio::fs::copy(src_path, dst_path).await?;
+ }
} else {
- tokio::fs::copy(src_path, dst_path).await?;
+ info!("skipping hidden file: {:?}", file_name);
}
}
@@ -193,12 +200,15 @@ mod pipes {
for item in contents.as_array().unwrap() {
let file_name = item["name"].as_str().unwrap();
- let download_url = item["download_url"].as_str().unwrap();
-
- let file_content = client.get(download_url).send().await?.bytes().await?;
- let file_path = dest_dir.join(file_name);
- tokio::fs::write(&file_path, &file_content).await?;
- info!("downloaded: {:?}", file_path);
+ if !is_hidden_file(std::ffi::OsStr::new(file_name)) {
+ let download_url = item["download_url"].as_str().unwrap();
+ let file_content = client.get(download_url).send().await?.bytes().await?;
+ let file_path = dest_dir.join(file_name);
+ tokio::fs::write(&file_path, &file_content).await?;
+ info!("downloaded: {:?}", file_path);
+ } else {
+ info!("skipping hidden file: {}", file_name);
+ }
}
Ok(())
@@ -229,16 +239,25 @@ mod pipes {
}
fn find_pipe_file(pipe_dir: &Path) -> anyhow::Result<PathBuf> {
- for entry in std::fs::read_dir(pipe_dir)? {
+ for entry in fs::read_dir(pipe_dir)? {
let entry = entry?;
let file_name = entry.file_name();
let file_name_str = file_name.to_str().unwrap();
- if file_name_str == "pipe.js" || file_name_str == "pipe.ts" {
+ if (file_name_str == "pipe.js" || file_name_str == "pipe.ts")
+ && !is_hidden_file(&file_name)
+ {
return Ok(entry.path());
}
}
anyhow::bail!("No pipe.js/pipe.ts found in the pipe/dist directory")
}
+
+ fn is_hidden_file(file_name: &std::ffi::OsStr) -> bool {
+ file_name
+ .to_str()
+ .map(|s| s.starts_with('.') || s == "Thumbs.db")
+ .unwrap_or(false)
+ }
}
#[cfg(feature = "pipes")]