1use crate::error::Result;
4use crate::presentation::Presentation as PresentationImpl;
5use std::fs::File;
6use std::io::BufReader;
7use std::path::Path;
8
9pub fn Presentation(pptx: Option<&str>) -> Result<PresentationImpl> {
13 let path = pptx.unwrap_or_else(|| {
14 "templates/default.pptx"
16 });
17
18 if Path::new(path).exists() {
19 let file = File::open(path)?;
20 let reader = BufReader::new(file);
21 PresentationImpl::open(reader)
22 } else {
23 PresentationImpl::new()
25 }
26}
27
28pub fn new_presentation() -> Result<PresentationImpl> {
30 PresentationImpl::new()
31}
32
33pub fn open_presentation<P: AsRef<Path>>(path: P) -> Result<PresentationImpl> {
35 let file = File::open(path)?;
36 let reader = BufReader::new(file);
37 PresentationImpl::open(reader)
38}
39