chore(i18n): finish translating code comments and scripts to English
CI / Format and clippy (push) Successful in 1m57s
CI / Dependency audit (push) Successful in 13s
CI / Check desktop app (Linux) (push) Successful in 3m54s
CI / Tests (Linux) (push) Failing after 7m25s
Release / Create release (push) Successful in 6s
Release / CLI (linux-aarch64) (push) Successful in 1m48s
Release / CLI (linux-x86_64) (push) Successful in 2m39s
Release / Desktop app (linux-aarch64) (push) Successful in 10m9s
Release / Desktop app (linux-x86_64) (push) Successful in 12m20s
Release / Desktop app (windows) (push) Successful in 7m32s
Release / Build latest.json (push) Successful in 5s

Completes the English-only standardization for code, comments, scripts
and CI templates (UI/CLI-facing strings stay bilingual pt-BR/en,
untouched). Covers the remaining crates/, apps/gui/ui/ and
apps/gui/src-tauri/ comments, .gitea/ workflow and template comments,
.githooks/ hooks, and the scripts/ source comments for the files
already renamed in a prior commit (check.sh, generate-logo.py,
install-hooks.sh).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VAyr8d7HuAdUGB6aA5xmDD
This commit is contained in:
Lucas RayanandClaude Sonnet 5 committed 2026-10-30 20:43:02 -03:00
1 parent da212e6926
commit 6328220c60
129 files changed
+1961 -1834

No files matched your search

+23 -23
View File
@@ -1,5 +1,5 @@
//! Gravação dos arquivos recuperados (sempre em outro destino) com SHA-256
//! e manifesto da sessão.
//! Writes recovered files to a separate destination volume along with SHA-256
//! digests, recovery journal, and session manifest.
use crate::error::{Error, Result};
use crate::fs::sanitize_name;
@@ -33,12 +33,12 @@ pub struct RecoverReport {
pub failed: Vec<(u64, String)>,
pub total_bytes: u64,
pub cancelled: bool,
/// Arquivos já recuperados e conferidos numa execução anterior (pulados ao retomar).
/// Files already recovered and SHA-256 verified in a prior run (skipped on resume).
#[serde(default)]
pub skipped: usize,
}
/// Recusa destinos que ficam no mesmo dispositivo da origem.
/// Rejects destination paths located on the same physical device as the source.
pub fn check_destination(source_path: Option<&Path>, dest: &Path) -> Result<()> {
crate::owner::create_dir_all_owned(dest)?;
let dest = dest.canonicalize()?;
@@ -69,24 +69,24 @@ pub fn check_destination(source_path: Option<&Path>, dest: &Path) -> Result<()>
}
if let Ok(meta) = std::fs::metadata(sp) {
if meta.is_file() {
// Imagem: evita gravar ao lado só se for o mesmo arquivo (não faz sentido), mas aceita.
// For image files: only reject writing directly over the source image file itself.
}
}
Ok(())
}
/// Como organizar os arquivos recuperados dentro do destino.
/// Directory layout strategy for recovered files inside the destination folder.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum RecoverLayout {
/// Pastas originais quando conhecidas; o resto separado por tipo (padrão).
/// Preserve original folder hierarchy when known; group carved files by type (default).
#[default]
Folders,
/// Uma pasta por tipo (Fotos, Documentos, Vídeos...).
/// Group into one folder per category (Photos, Documents, Videos, etc.).
Type,
/// Pastas por ano e mês (data da foto, ou a de modificação).
/// Group into `YYYY/YYYY-MM` folders by capture or modification date.
Date,
/// Tudo direto na pasta de destino.
/// Place all files flat inside the destination folder.
Flat,
}
@@ -130,7 +130,7 @@ pub fn recover_with(
recover_resumable(src, files, dest, layout, "", false, cancelled, progress)
}
/// Uma linha do diário de recuperação (`guara-diario.jsonl`): cada arquivo gravado e conferido.
/// A single entry in the recovery journal (`guara-diario.jsonl`) for a written and verified file.
#[derive(Debug, Clone, Serialize, Deserialize)]
struct JournalEntry {
source: String,
@@ -156,9 +156,9 @@ fn sha256_of_file(p: &Path) -> Option<String> {
Some(h.finalize().sha256)
}
/// Como `recover_with`, mas mantém um diário e, com `resume`, pula o que já foi
/// recuperado (e conferido por SHA-256) numa execução interrompida.
/// `source_key` identifica a origem para que o diário de outro disco não seja reaproveitado.
/// Like `recover_with`, but maintains an append-only journal and, when `resume` is set, skips
/// files already written and SHA-256 verified during an interrupted run.
/// `source_key` binds the journal to the source disk so another disk's journal is never reused.
#[allow(clippy::too_many_arguments)]
pub fn recover_resumable(
src: &dyn Source,
@@ -202,7 +202,7 @@ pub fn recover_resumable(
break;
}
progress(i, files.len(), report.total_bytes);
// retomada: já está lá e confere?
// resume check: does the file already exist on disk with the expected size and SHA-256?
if let Some(e) = prior.get(&f.id) {
let p = dest.join(&e.file.path);
if e.name == f.name && e.file.size == f.size && p.is_file() {
@@ -215,7 +215,7 @@ pub fn recover_resumable(
report.recovered.push(e.file.clone());
continue;
}
// incompleto ou alterado: refaz (é um arquivo nosso)
// incomplete or modified partial file from our previous run: overwrite it
let _ = std::fs::remove_file(&p);
}
}
@@ -321,7 +321,7 @@ fn target_rel(f: &Found, layout: RecoverLayout) -> PathBuf {
p
}
/// Espaço livre (bytes) no volume onde `path` está (ou estaria).
/// Returns available free bytes on the filesystem containing `path`.
pub fn free_space(path: &Path) -> Option<u64> {
let mut p = path;
while !p.exists() {
@@ -331,7 +331,7 @@ pub fn free_space(path: &Path) -> Option<u64> {
{
use std::os::unix::ffi::OsStrExt;
let c = std::ffi::CString::new(p.as_os_str().as_bytes()).ok()?;
// SAFETY: `c` é uma string C válida e `st` é uma estrutura de saída local.
// SAFETY: `c` is a valid NUL-terminated C string and `st` is a valid local output struct.
let mut st: libc::statvfs = unsafe { std::mem::zeroed() };
if unsafe { libc::statvfs(c.as_ptr(), &mut st) } != 0 {
return None;
@@ -348,7 +348,7 @@ pub fn free_space(path: &Path) -> Option<u64> {
.chain(std::iter::once(0))
.collect();
let mut free = 0u64;
// SAFETY: `wide` termina em NUL e o ponteiro de saída é válido.
// SAFETY: `wide` is NUL-terminated and the output pointer is valid.
let ok = unsafe {
GetDiskFreeSpaceExW(
wide.as_ptr(),
@@ -361,7 +361,7 @@ pub fn free_space(path: &Path) -> Option<u64> {
}
}
/// Escreve o conteúdo e devolve o SHA-256.
/// Streams the recovered file content to `out` and returns its hex SHA-256 digest.
pub fn write_file(src: &dyn Source, f: &Found, path: &Path) -> Result<Hashes> {
let mut out = std::fs::OpenOptions::new()
.write(true)
@@ -443,8 +443,8 @@ pub fn write_file(src: &dyn Source, f: &Found, path: &Path) -> Result<Hashes> {
Ok(hasher.finalize())
}
/// Lê `buf.len()` bytes do conteúdo lógico de um achado a partir de `offset`
/// (usado para streaming/pré-visualização sem gravar em disco).
/// Reads up to `buf.len()` bytes of a recovered file's logical content starting at `offset`
/// (used for zero-copy streaming and preview without writing to disk).
pub fn read_found_at(
src: &dyn Source,
f: &Found,
@@ -510,7 +510,7 @@ pub fn read_found_at(
}
}
/// Um arquivo achado visto como origem de leitura posicional (para leitores de formato).
/// Adapter exposing a recovered `Found` file as a positional `Source` (for format parsers).
pub struct FoundSource<'a> {
pub src: &'a dyn Source,
pub found: &'a Found,