Home / File/ pathutil.rs — tailwindcss Source File

pathutil.rs — tailwindcss Source File

Architecture documentation for pathutil.rs, a rust file in the tailwindcss codebase. 7 imports, 0 dependents.

File rust Oxide PreProcessors 7 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  14fdbab7_73ef_0246_2884_5f8133abec90["pathutil.rs"]
  cf006a3e_51d2_5361_1dd4_6d904d0bfa75["std::"]
  14fdbab7_73ef_0246_2884_5f8133abec90 --> cf006a3e_51d2_5361_1dd4_6d904d0bfa75
  b4074c91_a057_d2b4_325b_964cdbbf9842["crate::walk::DirEntry"]
  14fdbab7_73ef_0246_2884_5f8133abec90 --> b4074c91_a057_d2b4_325b_964cdbbf9842
  6df3f6c1_7d85_37da_e7be_dee507bef610["std::os::unix::ffi::OsStrExt"]
  14fdbab7_73ef_0246_2884_5f8133abec90 --> 6df3f6c1_7d85_37da_e7be_dee507bef610
  11fb1fa0_85c7_ee81_7922_5ce44de62e50["std::os::windows::fs::MetadataExt"]
  14fdbab7_73ef_0246_2884_5f8133abec90 --> 11fb1fa0_85c7_ee81_7922_5ce44de62e50
  0b0d5ca5_15d3_0022_8d76_57116efac809["winapi_util::file"]
  14fdbab7_73ef_0246_2884_5f8133abec90 --> 0b0d5ca5_15d3_0022_8d76_57116efac809
  41c99cb7_8b1c_223b_0921_3a5f8a92dfe4["memchr::memchr"]
  14fdbab7_73ef_0246_2884_5f8133abec90 --> 41c99cb7_8b1c_223b_0921_3a5f8a92dfe4
  ed0fd2f4_fa1f_ee7a_bd79_367adb4a3c4a["memchr::memrchr"]
  14fdbab7_73ef_0246_2884_5f8133abec90 --> ed0fd2f4_fa1f_ee7a_bd79_367adb4a3c4a
  style 14fdbab7_73ef_0246_2884_5f8133abec90 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

use std::{ffi::OsStr, path::Path};

use crate::walk::DirEntry;

/// Returns true if and only if this entry is considered to be hidden.
///
/// This only returns true if the base name of the path starts with a `.`.
///
/// On Unix, this implements a more optimized check.
#[cfg(unix)]
pub(crate) fn is_hidden(dent: &DirEntry) -> bool {
    use std::os::unix::ffi::OsStrExt;

    if let Some(name) = file_name(dent.path()) {
        name.as_bytes().get(0) == Some(&b'.')
    } else {
        false
    }
}

/// Returns true if and only if this entry is considered to be hidden.
///
/// On Windows, this returns true if one of the following is true:
///
/// * The base name of the path starts with a `.`.
/// * The file attributes have the `HIDDEN` property set.
#[cfg(windows)]
pub(crate) fn is_hidden(dent: &DirEntry) -> bool {
    use std::os::windows::fs::MetadataExt;
    use winapi_util::file;

    // This looks like we're doing an extra stat call, but on Windows, the
    // directory traverser reuses the metadata retrieved from each directory
    // entry and stores it on the DirEntry itself. So this is "free."
    if let Ok(md) = dent.metadata() {
        if file::is_hidden(md.file_attributes() as u64) {
            return true;
        }
    }
    if let Some(name) = file_name(dent.path()) {
        name.to_str().map(|s| s.starts_with(".")).unwrap_or(false)
    } else {
        false
    }
}

/// Returns true if and only if this entry is considered to be hidden.
///
/// This only returns true if the base name of the path starts with a `.`.
#[cfg(not(any(unix, windows)))]
pub(crate) fn is_hidden(dent: &DirEntry) -> bool {
    if let Some(name) = file_name(dent.path()) {
        name.to_str().map(|s| s.starts_with(".")).unwrap_or(false)
    } else {
        false
    }
}

/// Strip `prefix` from the `path` and return the remainder.
///
// ... (82 more lines)

Domain

Subdomains

Dependencies

  • crate::walk::DirEntry
  • memchr::memchr
  • memchr::memrchr
  • std::
  • std::os::unix::ffi::OsStrExt
  • std::os::windows::fs::MetadataExt
  • winapi_util::file

Frequently Asked Questions

What does pathutil.rs do?
pathutil.rs is a source file in the tailwindcss codebase, written in rust. It belongs to the Oxide domain, PreProcessors subdomain.
What functions are defined in pathutil.rs?
pathutil.rs defines 4 function(s): file_name, is_file_name, is_hidden, strip_prefix.
What does pathutil.rs depend on?
pathutil.rs imports 7 module(s): crate::walk::DirEntry, memchr::memchr, memchr::memrchr, std::, std::os::unix::ffi::OsStrExt, std::os::windows::fs::MetadataExt, winapi_util::file.
Where is pathutil.rs in the architecture?
pathutil.rs is located at crates/ignore/src/pathutil.rs (domain: Oxide, subdomain: PreProcessors, directory: crates/ignore/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free