Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamVenner committed Sep 10, 2023
1 parent 66fc0cc commit 5498916
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fastgmad-lib/src/create/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
error::{fastgmad_error, fastgmad_io_error, FastGmadError},
util::{WriteEx, self},
util::{self, WriteEx},
whitelist,
};
use std::{
Expand Down
11 changes: 8 additions & 3 deletions fastgmad-lib/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
use std::{io::{BufRead, Write}, path::Path};
use std::{
io::{BufRead, Write},
path::Path,
};

pub fn is_hidden_file(path: &Path) -> Result<bool, std::io::Error> {
let hidden;

#[cfg(unix)] {
#[cfg(unix)]
{
if let Some(file_name) = path.file_name() {
use std::os::unix::prelude::OsStrExt;
hidden = file_name.as_bytes().starts_with(b".");
Expand All @@ -12,7 +16,8 @@ pub fn is_hidden_file(path: &Path) -> Result<bool, std::io::Error> {
}
}

#[cfg(windows)] {
#[cfg(windows)]
{
use std::os::windows::fs::MetadataExt;
const HIDDEN: u32 = 0x00000002;
hidden = std::fs::metadata(path)?.file_attributes() & HIDDEN != 0;
Expand Down

0 comments on commit 5498916

Please sign in to comment.