mirror of
https://github.com/storytold/cadcraft.git
synced 2026-11-09 03:50:04 -06:00
The folders are made by a new writer only user-named targets use, so autosave and a dangling symlink's target keep the strict write_atomic. Save, Save As, Export, Plot, WBLOCK, layout templates, render and the CLI report the topmost new folder at the command line and in createdFolder.
16 lines
608 B
Rust
16 lines
608 B
Rust
use super::args::{SampleArgs, SampleName};
|
|
use super::error::Result;
|
|
use super::output::{Streams, report_new_folder, write_atomic};
|
|
|
|
pub(crate) fn sample(a: &SampleArgs, io: &mut Streams) -> Result {
|
|
let d = match a.name {
|
|
SampleName::Bracket => cadcraft_engine::sample::bracket(),
|
|
SampleName::Floorplan => cadcraft_engine::sample::floor_plan(),
|
|
};
|
|
let bytes = cadcraft_io::write(&d, &a.output)?;
|
|
let folder = write_atomic(&a.output, &bytes)?;
|
|
report_new_folder(folder, io);
|
|
io.errln(format_args!("wrote {} ({} bytes)", a.output.display(), bytes.len()));
|
|
Ok(())
|
|
}
|