1
Fork 0

implement TargetSelection::is_cygwin function

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2024-12-08 18:27:22 +03:00
parent ae3703cdf2
commit c4d7f1d29f

View file

@ -565,6 +565,12 @@ impl TargetSelection {
self.ends_with("windows-gnu") self.ends_with("windows-gnu")
} }
pub fn is_cygwin(&self) -> bool {
self.is_windows() &&
// ref. https://cygwin.com/pipermail/cygwin/2022-February/250802.html
env::var("OSTYPE").is_ok_and(|v| v.to_lowercase().contains("cygwin"))
}
/// Path to the file defining the custom target, if any. /// Path to the file defining the custom target, if any.
pub fn filepath(&self) -> Option<&Path> { pub fn filepath(&self) -> Option<&Path> {
self.file.as_ref().map(Path::new) self.file.as_ref().map(Path::new)