This commit is contained in:
Lynne Megido 2021-03-01 19:21:00 +10:00
parent 32da919f81
commit 5907309689
8 changed files with 15 additions and 15 deletions

View file

@ -7,7 +7,7 @@ use std::path::PathBuf;
use snailquote::escape;
use crate::scanerror::ScanError;
use crate::scan_error::ScanError;
use crate::{Findings, BACKEND};
/// The current version of fif, as defined in Cargo.toml.

View file

@ -10,7 +10,7 @@ use cached::cached;
use mime_guess::Mime;
use smartstring::alias::String;
use crate::mimedb::MimeDb;
use crate::mime_db::MimeDb;
/// The number of bytes to read initially.
///

View file

@ -28,32 +28,32 @@ use walkdir::{DirEntry, WalkDir};
use crate::findings::Findings;
use crate::formats::{Format, Script};
use crate::mimedb::MimeDb;
use crate::mime_db::MimeDb;
use crate::parameters::OutputFormat;
use crate::scanerror::ScanError;
use crate::scan_error::ScanError;
use env_logger::Env;
use std::process::exit;
mod extensionset;
mod extension_set;
mod findings;
mod formats;
mod inspectors;
mod mimedb;
mod mime_db;
mod parameters;
mod scanerror;
mod scan_error;
#[cfg(test)]
mod tests;
cfg_if! {
if #[cfg(any(all(not(unix), not(feature = "xdg-mime-backend")), all(unix, feature = "infer-backend")))] {
/// A [OnceCell] holding an instance of [mimedb::MimeDb].
static MIMEDB: OnceCell<mimedb::InferDb> = OnceCell::new();
/// A [OnceCell] holding an instance of [mime_db::MimeDb].
static MIMEDB: OnceCell<mime_db::InferDb> = OnceCell::new();
/// The backend being used; either "Infer" or "XDG-Mime".
const BACKEND: &str = "Infer";
} else {
/// A [OnceCell] holding an instance of [mimedb::MimeDb].
static MIMEDB: OnceCell<mimedb::XdgDb> = OnceCell::new();
/// A [OnceCell] holding an instance of [mime_db::MimeDb].
static MIMEDB: OnceCell<mime_db::XdgDb> = OnceCell::new();
/// The backend being used; either "Infer" or "XDG-Mime".
const BACKEND: &str = "XDG-Mime";
}
@ -301,12 +301,12 @@ fn init_db() {
cfg_if! {
if #[cfg(any(all(not(unix), not(feature = "xdg-mime-backend")), all(unix, feature = "infer-backend")))] {
MIMEDB
.set(mimedb::InferDb::init())
.set(mime_db::InferDb::init())
.or(Err("Failed to initialise Infer backend!"))
.unwrap();
} else {
MIMEDB
.set(mimedb::XdgDb::init())
.set(mime_db::XdgDb::init())
.or(Err("Failed to initialise XDG Mime backend!"))
.unwrap();
}

View file

@ -2,7 +2,7 @@
use std::path::PathBuf;
use crate::extensionset::ExtensionSet;
use crate::extension_set::ExtensionSet;
use clap::{Clap};
use smartstring::{LazyCompact, SmartString};

View file

@ -1,5 +1,5 @@
use crate::inspectors::mime_extension_lookup;
use crate::mimedb::*;
use crate::mime_db::*;
use crate::{extension_from_path, init_db, scan_directory, scan_from_walkdir};
use crate::parameters::Parameters;