Expand description
Grouped files: files that go together show as one entry of the in-app picker (a RAW with its sidecars, Lightroom’s and digiKam’s habit), and choosing it gives the main file, with the others beside it.
egui-pop has the mechanism and no rule of its own: nothing groups until an
application declares a FileGrouping, with FilesPlugin::grouping or
Groupings::register. A SidecarRule covers the usual case, by
extension; a grouping of its own reads the names as it likes.
use egui_pop_api::files::groups::{Groupings, SidecarRule};
use std::path::Path;
use std::sync::Arc;
let photos = SidecarRule::new("my_app.photos", &["cr3", "nef"], &["xmp", "jpg"])
.badge("jpg", "JPEG");
let groupings = Groupings::default();
groupings.register(Arc::new(photos));
let names = ["a.cr3", "a.cr3.xmp", "a.jpg", "b.jpg", "c.nef", "c.xmp"];
let groups = groupings.in_folder(Path::new("/shoot"), &names);
assert_eq!(groups[0].main, Path::new("/shoot/a.cr3"));
assert_eq!(groups[0].badges, ["XMP", "JPEG"]);
assert_eq!(groups[1].main, Path::new("/shoot/c.nef"));
assert_eq!(groups.len(), 2, "b.jpg has no RAW: it stays a file of its own");Structs§
- File
Group - A group, as the picker shows it and as a choice gives it.
- Groupings
- The groupings declared, as a service of
Files. - Name
Group - One group as a
FileGroupingfinds it, by the names of a folder’s files. - Sidecar
Rule - The usual grouping, by extension:
x.jpg,x.xmpandx.cr3.xmpbelong tox.cr3. The stem has to be the same, whatever the case of the extensions.
Traits§
- File
Grouping - Which of a folder’s files go together: declared by the application, asked once per listing on the interface thread (the picker reads a folder there too), with names and nothing else, so that it reads no file.