diff --git a/src/main.rs b/src/main.rs index ce51d69..d8b2f56 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,16 @@ mod utils; static DEFAULT_NUMBER_OF_LINES: usize = 20; +#[cfg(windows)] +fn init_color() { + ansi_term::enable_ansi_support().expect("Couldn't enable color support"); +} + +#[cfg(not(windows))] +fn init_color() {} + fn main() { + init_color(); let def_num_str = DEFAULT_NUMBER_OF_LINES.to_string(); let options = App::new("Dust") .about("Like du but more intuitive") diff --git a/src/utils/platform.rs b/src/utils/platform.rs index e694ac6..86276dc 100644 --- a/src/utils/platform.rs +++ b/src/utils/platform.rs @@ -1,5 +1,6 @@ use jwalk::DirEntry; +#[cfg(target_family = "unix")] fn get_block_size() -> u64 { // All os specific implementations of MetatdataExt seem to define a block as 512 bytes // https://doc.rust-lang.org/std/os/linux/fs/trait.MetadataExt.html#tymethod.st_blocks