feat: add rename functionality to file editor
CI / Lint & Test (pull_request) Failing after 6m40s
CI / Build Linux (pull_request) Has been skipped
CI / Build Windows (cross-compile) (pull_request) Has been skipped
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m23s

Add ability to rename files and folders through the context menu:
- Add rename_path Tauri command in backend
- Add renamePath function to editor store that updates open tabs
- Add rename option to context menu with pencil icon
- Update InputDialog to support initial value for rename operations
This commit is contained in:
2026-01-28 16:49:29 -08:00
committed by Naomi Carrigan
parent abacb0131f
commit 505e24cbd2
6 changed files with 129 additions and 4 deletions
+21
View File
@@ -535,6 +535,27 @@ pub async fn delete_directory(path: String) -> Result<(), String> {
Ok(())
}
#[tauri::command]
pub async fn rename_path(old_path: String, new_path: String) -> Result<(), String> {
use std::fs;
use std::path::Path;
let old = Path::new(&old_path);
let new = Path::new(&new_path);
if !old.exists() {
return Err("Path does not exist".to_string());
}
if new.exists() {
return Err("Destination already exists".to_string());
}
fs::rename(old, new).map_err(|e| format!("Failed to rename: {}", e))?;
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
+1
View File
@@ -158,6 +158,7 @@ pub fn run() {
create_directory,
delete_file,
delete_directory,
rename_path,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");