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 snailquote::escape;
use crate::scanerror::ScanError; use crate::scan_error::ScanError;
use crate::{Findings, BACKEND}; use crate::{Findings, BACKEND};
/// The current version of fif, as defined in Cargo.toml. /// The current version of fif, as defined in Cargo.toml.

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
use crate::inspectors::mime_extension_lookup; 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::{extension_from_path, init_db, scan_directory, scan_from_walkdir};
use crate::parameters::Parameters; use crate::parameters::Parameters;