Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/walkdir.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/build.rs b/build.rs
index 9f26302..de9ae04 100644
--- a/build.rs
+++ b/build.rs
@@ -1,9 +1,25 @@
#[cfg(not(target_os = "dragonfly"))]
-fn main() {}
+fn main() {
+ enable_getdents();
+}
#[cfg(target_os = "dragonfly")]
fn main() {
+ enable_getdents();
cc::Build::new()
.file("src/os/unix/errno-dragonfly.c")
.compile("errno-dragonfly");
}
+
+fn enable_getdents() {
+ if std::env::var_os("CARGO_CFG_WALKDIR_DISABLE_GETDENTS").is_some() {
+ return;
+ }
+ let os = match std::env::var("CARGO_CFG_TARGET_OS") {
+ Err(_) => return,
+ Ok(os) => os,
+ };
+ if os == "linux" {
+ println!("cargo:rustc-cfg=walkdir_getdents");
+ }
+}