use std::fmt::{Show, Formatter, Error};
use std::path::Path;
pub use self::ConflictType::{
Wuala,
Dropbox
};
pub enum ConflictType
{
Wuala,
Dropbox
}
pub type OrigFileName = String;
pub type Details = String;
#[deriving(Clone)]
pub struct ConflictingFile
{
pub details: String,
pub path : Path
}
pub struct Conflict
{
pub original_path : Path,
pub conflicting_files: Vec<ConflictingFile>
}
impl Show for ConflictingFile
{
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
{
write!(f, "ConflictingFile (details: {}, path: {})",
self.details, self.path.display())
}
}
impl Show for Conflict
{
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
{
try!(writeln!(f, "Conflicting file: {}", self.original_path.display()));
for i in range(0, self.conflicting_files.len()) {
try!(writeln!(f, " ({}) {}", i + 1, self.conflicting_files[i].details));
}
Ok(())
}
}