{"record":{"id":"edbd5ee47227ee0c","repo":"tonhowtf/omniget","slug":"escolha-as-imagens-ou-a-pasta","errorCode":null,"errorMessage":"escolha as imagens ou a pasta","messagePattern":"escolha as imagens ou a pasta","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/image_sprite.rs","lineNumber":540,"sourceCode":"\n    super::report(progress, \"img-sprite\", \"done\", total, Some(total), None);\n    Ok(SpriteResult {\n        mode: \"pack\".into(),\n        count: frames.len() as u32,\n        outputs,\n        frames,\n        sheet: Some(sheet_path.to_string_lossy().to_string()),\n        atlas,\n        width: sheet.width(),\n        height: sheet.height(),\n        skipped,\n    })\n}\n\nfn batch(opts: &SpriteOptions, progress: &ProgressFn) -> anyhow::Result<SpriteResult> {\n    let files = gather(opts);\n    if files.is_empty() {\n        return Err(anyhow!(\"escolha as imagens ou a pasta\"));\n    }\n    let total = files.len() as u64;\n    let mut outputs = Vec::new();\n    let mut frames = Vec::new();\n    let mut skipped = 0u32;\n    let suffix = if opts.suffix.is_empty() {\n        \"-lote\"\n    } else {\n        opts.suffix.as_str()\n    };\n    for (i, path) in files.iter().enumerate() {\n        super::report(\n            progress,\n            \"img-sprite\",\n            \"progress\",\n            i as u64,\n            Some(total),\n            Some(path.to_string_lossy().to_string()),","sourceCodeStart":522,"sourceCodeEnd":558,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/image_sprite.rs#L522-L558","documentation":"Empty-input guard in the sprite batch mode: batch() collects candidate images with gather(opts) and aborts when none are found, before any packing work. It fires when the user provides neither image files nor a folder (or the given folder/paths yield no images), so there is nothing to build a sheet from.","triggerScenarios":"Calling run() with mode \"batch\" where opts input is empty, the folder is empty, or the pattern/extension filter excludes all files.","commonSituations":"User picks a folder that contains only subfolders or non-image files; wrong suffix/pattern config; folder path typo.","solutions":["Set input to a folder with images or a pattern that matches at least one image.","Confirm gather() accepts the file extensions present in the folder.","Validate input presence in the UI/CLI before calling run().","Check gather()'s recursion settings if images live in subdirectories."],"exampleFix":"// before\nlet files = gather(&opts); // empty folder\nimage_sprite::run(&opts, &progress)?;\n// after\nif gather(&opts).is_empty() {\n    anyhow::bail!(\"a pasta/padrão não contém imagens\");\n}\nimage_sprite::run(&opts, &progress)?;","handlingStrategy":"validation","validationCode":"fn has_images(opts: &SpriteOptions) -> bool { !gather(opts).is_empty() }\n// call run() only if has_images(&opts)","typeGuard":null,"tryCatchPattern":"match image_sprite::run(&opts, &progress) {\n    Err(e) if e.to_string().contains(\"escolha as imagens\") => prompt_folder_selection(),\n    other => other?,\n}","preventionTips":["Verify the folder contains images (not just subfolders) before batching.","Enable recursive gathering if images are nested.","Keep extension whitelists in sync with the files users supply.","Disable the batch button until gather() finds files."],"tags":["missing-input","validation","batch","rust"],"backgroundTag":"empty-required-field","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}