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

try fix

Louis Beaumontd54468d5ad52
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 60ef5278c..367465fc1 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.5.8"
+version = "0.5.9"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-app-tauri/src-tauri/src/sidecar.rs b/screenpipe-app-tauri/src-tauri/src/sidecar.rs
index 017c9a01e..523c60978 100644
--- a/screenpipe-app-tauri/src-tauri/src/sidecar.rs
+++ b/screenpipe-app-tauri/src-tauri/src/sidecar.rs
@@ -310,9 +310,9 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
c = c.env("HF_ENDPOINT", "https://hf-mirror.com");
}
- let current_path = env::var("PATH").unwrap_or_default();
- let new_path = format!("{};{}", path_to_sidecars, current_path);
- c = c.env("PATH", new_path);
+ // let current_path = env::var("PATH").unwrap_or_default();
+ // let new_path = format!("{};{}", path_to_sidecars, current_path);
+ // c = c.env("PATH", new_path);
let c = c.args(&args);
@@ -332,9 +332,9 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
command = command.env("HF_ENDPOINT", "https://hf-mirror.com");
}
- let current_path = env::var("PATH").unwrap_or_default();
- let new_path = format!("{}:{}", path_to_sidecars, current_path);
- command = command.env("PATH", new_path);
+ // let current_path = env::var("PATH").unwrap_or_default();
+ // let new_path = format!("{}:{}", path_to_sidecars, current_path);
+ // command = command.env("PATH", new_path);
let command = command.args(&args);
diff --git a/screenpipe-core/src/pipes.rs b/screenpipe-core/src/pipes.rs
index bb9ad9296..298830d2c 100644
--- a/screenpipe-core/src/pipes.rs
+++ b/screenpipe-core/src/pipes.rs
@@ -17,6 +17,7 @@ mod pipes {
use tokio::io::{AsyncBufReadExt, BufReader};
use tracing::{debug, error, info};
use url::Url;
+ use which::which;
// Update this function near the top of the file
fn sanitize_pipe_name(name: &str) -> String {
@@ -276,6 +277,75 @@ mod pipes {
.map(|s| s.starts_with('.') || s == "Thumbs.db")
.unwrap_or(false)
}
+
+ #[cfg(not(windows))]
+ const DENO_EXECUTABLE_NAME: &str = "deno";
+
+ #[cfg(windows)]
+ const DENO_EXECUTABLE_NAME: &str = "deno.exe";
+
+ pub fn find_deno() -> Option<PathBuf> {
+ debug!("starting search for deno executable");
+
+ // check if `deno` is in the PATH environment variable
+ if let Ok(path) = which(DENO_EXECUTABLE_NAME) {
+ debug!("found deno in PATH: {:?}", path);
+ return Some(path);
+ }
+ debug!("deno not found in PATH");
+
+ // check in current working directory
+ if let Ok(cwd) = std::env::current_dir() {
+ debug!("current working directory: {:?}", cwd);
+ let deno_in_cwd = cwd.join(DENO_EXECUTABLE_NAME);
+ if deno_in_cwd.is_file() && deno_in_cwd.exists() {
+ debug!("found deno in current working directory: {:?}", deno_in_cwd);
+ return Some(deno_in_cwd);
+ }
+ debug!("deno not found in current working directory");
+ }
+
+ // check in the same folder as the executable
+ if let Ok(exe_path) = std::env::current_exe() {
+ if let Some(exe_folder) = exe_path.parent() {
+ debug!("executable folder: {:?}", exe_folder);
+ let deno_in_exe_folder = exe_folder.join(DENO_EXECUTABLE_NAME);
+ if deno_in_exe_folder.exists() {
+ debug!("found deno in executable folder: {:?}", deno_in_exe_folder);
+ return Some(deno_in_exe_folder);
+ }
+ debug!("deno not found in executable folder");
+
+ // platform-specific checks
+ #[cfg(target_os = "macos")]
+ {
+ let resources_folder = exe_folder.join("../Resources");
+ debug!("resources folder: {:?}", resources_folder);
+ let deno_in_resources = resources_folder.join(DENO_EXECUTABLE_NAME);
+ if deno_in_resources.exists() {
+ debug!("found deno in resources folder: {:?}", deno_in_resources);
+ return Some(deno_in_resources);
+ }
+ debug!("deno not found in resources folder");
+ }
+
+ #[cfg(target_os = "linux")]
+ {
+ let lib_folder = exe_folder.join("lib");
+ debug!("lib folder: {:?}", lib_folder);
+ let deno_in_lib = lib_folder.join(DENO_EXECUTABLE_NAME);
+ if deno_in_lib.exists() {
+ debug!("found deno in lib folder: {:?}", deno_in_lib);
+ return Some(deno_in_lib);
+ }
+ debug!("deno not found in lib folder");
+ }
+ }
+ }
+
+ error!("deno not found");
+ None // return None if deno is not found
+ }
}
#[cfg(feature = "pipes")]