From d0014711c8690c11884f276692290c8909ee2c1d Mon Sep 17 00:00:00 2001 From: KeksNino Date: Sun, 22 Nov 2026 01:47:20 +0100 Subject: [PATCH] fix: broken edit.rs --- src/edit.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/edit.rs b/src/edit.rs index 803bb05..9730f58 100644 --- a/src/edit.rs +++ b/src/edit.rs @@ -10,7 +10,7 @@ use std::io::Write; use std::path::PathBuf; use std::{fs::File, fs::read_dir, io::Read, process::Command}; -pub fn edit(file_path: Vec, extra_files: [String; 9]) -> std::io::Result<()> { +pub fn edit(file_path: Vec, extra_files: &[String]) -> std::io::Result<()> { let tmp_file_path = PathBuf::from("/tmp/keks-sort-metadata"); let mut tmp_file = File::create(&tmp_file_path)?; let editor = var("EDITOR").unwrap(); @@ -34,15 +34,22 @@ pub fn edit(file_path: Vec, extra_files: [String; 9]) -> std::io::Resul continue; } - let tag = crate::get_metadata(&path); + let tag = match crate::get_metadata(&path) { + Ok(tag) => tag, + Err(err) => { + eprintln!("Failed to get metadata for {:?}: {}", path, err); + continue; + } + }; files.push(FileMetadata { path, tag }); } } else { - let tag = &crate::get_metadata(file); - files.push(FileMetadata { - path: file.to_path_buf(), - tag: tag.clone(), - }); + if let Ok(tag) = crate::get_metadata(file) { + files.push(FileMetadata { + path: file.to_path_buf(), + tag: tag.clone(), + }); + } } }