Disable Windows Support for maildir at it is not supported by the crate

pull/35/head
Benedikt Terhechte 2 years ago
parent 210620b722
commit e1c6f88731

@ -16,6 +16,7 @@ pub enum FormatType {
AppleMail,
GmailVault,
Mbox,
#[cfg(not(target_os = "windows"))]
Maildir,
}
@ -29,6 +30,7 @@ impl FormatType {
FormatType::AppleMail => "Apple Mail",
FormatType::GmailVault => "Gmail Vault Download",
FormatType::Mbox => "Mbox",
#[cfg(not(target_os = "windows"))]
FormatType::Maildir => "Maildir",
}
}
@ -41,6 +43,9 @@ impl Default for FormatType {
#[cfg(target_os = "macos")]
return FormatType::AppleMail;
#[cfg(target_os = "windows")]
return FormatType::Mbox;
#[cfg(not(target_os = "macos"))]
return FormatType::Maildir;
}
@ -58,6 +63,7 @@ impl From<&str> for FormatType {
"apple" => FormatType::AppleMail,
"gmailvault" => FormatType::GmailVault,
"mbox" => FormatType::Mbox,
#[cfg(not(target_os = "windows"))]
"maildir" => FormatType::Maildir,
_ => panic!("Unknown format: {}", &format),
}
@ -70,6 +76,7 @@ impl From<FormatType> for String {
FormatType::AppleMail => "apple".to_owned(),
FormatType::GmailVault => "gmailvault".to_owned(),
FormatType::Mbox => "mbox".to_owned(),
#[cfg(not(target_os = "windows"))]
FormatType::Maildir => "maildir".to_owned(),
}
}

@ -90,6 +90,7 @@ impl ImporterUI {
let importer = ps_importer::mbox_importer(config);
adapter.process(database, importer)?
}
#[cfg(not(target_os = "windows"))]
FormatType::Maildir => {
let importer = ps_importer::maildir_importer(config);
adapter.process(database, importer)?

@ -4,12 +4,14 @@ pub use ps_core::eyre::Result;
mod apple_mail;
mod gmailbackup;
#[cfg(not(target_os = "windows"))]
mod maildir_mail;
mod mbox;
pub mod shared;
pub use apple_mail::AppleMail;
pub use gmailbackup::Gmail;
#[cfg(not(target_os = "windows"))]
pub use maildir_mail::Maildir;
pub use mbox::Mbox;

@ -88,6 +88,7 @@ pub fn mbox_importer(config: Config) -> Importer<formats::Mbox> {
Importer::new(config, formats::Mbox::default())
}
#[cfg(not(target_os = "windows"))]
pub fn maildir_importer(config: Config) -> Importer<formats::Maildir> {
Importer::new(config, formats::Maildir::default())
}
@ -97,6 +98,7 @@ pub fn default_path(format: &FormatType) -> Option<PathBuf> {
FormatType::AppleMail => formats::AppleMail::default_path(),
FormatType::GmailVault => formats::Gmail::default_path(),
FormatType::Mbox => formats::Mbox::default_path(),
#[cfg(not(target_os = "windows"))]
FormatType::Maildir => formats::Maildir::default_path(),
}
}

Loading…
Cancel
Save