-
- // moves posts to their next
- fn shift(&self, configuration: &Configuration) -> Result<()> {
- for i in (0..configuration.max_posts).rev() {
- let source = configuration.posts_directory.join(i.to_string());
- let target = configuration.posts_directory.join((i + 1).to_string());
-
- println!("Moving {} source to {}", source.display(), target.display());
-
- if source.exists() {
- match rename(&source, &target) {
- Ok(_) => continue,
- Err(e) => return Err(Error::new(e.kind(), format!("Could not shift post {} to {}", source.display(), target.display())))
- }
- }
- }
- Ok(())
- }