generated from nhcarrigan/template
fix: all paths should be nix
This commit is contained in:
@@ -162,10 +162,17 @@ pub async fn validate_directory(
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the canonicalized (absolute) path
|
// Return the canonicalized (absolute) path with forward slashes
|
||||||
expanded_path
|
expanded_path
|
||||||
.canonicalize()
|
.canonicalize()
|
||||||
.map(|p| p.to_string_lossy().to_string())
|
.map(|p| {
|
||||||
|
// Convert to string and normalize path separators to forward slashes
|
||||||
|
let path_str = p.to_string_lossy().to_string();
|
||||||
|
// On Windows, replace backslashes with forward slashes
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
let path_str = path_str.replace('\\', "/");
|
||||||
|
path_str
|
||||||
|
})
|
||||||
.map_err(|e| format!("Failed to resolve path: {}", e))
|
.map_err(|e| format!("Failed to resolve path: {}", e))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,9 +444,14 @@ pub async fn list_directory(path: String) -> Result<Vec<FileEntry>, String> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let path_str = path.to_string_lossy().to_string();
|
||||||
|
// On Windows, replace backslashes with forward slashes
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
let path_str = path_str.replace('\\', "/");
|
||||||
|
|
||||||
file_entries.push(FileEntry {
|
file_entries.push(FileEntry {
|
||||||
name,
|
name,
|
||||||
path: path.to_string_lossy().to_string(),
|
path: path_str,
|
||||||
is_directory: path.is_dir(),
|
is_directory: path.is_dir(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,12 @@ impl WslBridge {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let working_dir = &options.working_dir;
|
let working_dir = &options.working_dir;
|
||||||
self.working_directory = working_dir.clone();
|
// Normalize path separators to forward slashes
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
let normalized_dir = working_dir.replace('\\', "/");
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
let normalized_dir = working_dir.clone();
|
||||||
|
self.working_directory = normalized_dir;
|
||||||
|
|
||||||
emit_connection_status(
|
emit_connection_status(
|
||||||
&app,
|
&app,
|
||||||
@@ -183,7 +188,7 @@ impl WslBridge {
|
|||||||
})?;
|
})?;
|
||||||
|
|
||||||
eprintln!("[DEBUG] Found claude at: {}", claude_path);
|
eprintln!("[DEBUG] Found claude at: {}", claude_path);
|
||||||
eprintln!("[DEBUG] Working dir: {}", working_dir);
|
eprintln!("[DEBUG] Working dir: {}", &self.working_directory);
|
||||||
|
|
||||||
let mut cmd = Command::new(&claude_path);
|
let mut cmd = Command::new(&claude_path);
|
||||||
cmd.args([
|
cmd.args([
|
||||||
@@ -225,7 +230,7 @@ impl WslBridge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.current_dir(working_dir);
|
cmd.current_dir(&self.working_directory);
|
||||||
|
|
||||||
// Set API key as environment variable if specified
|
// Set API key as environment variable if specified
|
||||||
if let Some(ref api_key) = options.api_key {
|
if let Some(ref api_key) = options.api_key {
|
||||||
@@ -241,7 +246,7 @@ impl WslBridge {
|
|||||||
let mut cmd = Command::new("wsl");
|
let mut cmd = Command::new("wsl");
|
||||||
|
|
||||||
// Build the claude command with all arguments
|
// Build the claude command with all arguments
|
||||||
let mut claude_cmd = format!("cd '{}' && ", working_dir);
|
let mut claude_cmd = format!("cd '{}' && ", &self.working_directory);
|
||||||
|
|
||||||
// Set API key as environment variable if specified
|
// Set API key as environment variable if specified
|
||||||
if let Some(ref api_key) = options.api_key {
|
if let Some(ref api_key) = options.api_key {
|
||||||
|
|||||||
Reference in New Issue
Block a user