config
}
- /// Try to find the relative path of `bindir`.
- pub fn bindir_relative(&self) -> Option<&Path> {
+ /// Try to find the relative path of `bindir`, otherwise return it in full.
+ pub fn bindir_relative(&self) -> &Path {
let bindir = &self.bindir;
- if bindir.is_relative() {
- Some(bindir)
- } else {
+ if bindir.is_absolute() {
// Try to make it relative to the prefix.
- bindir.strip_prefix(self.prefix.as_ref()?).ok()
+ if let Some(prefix) = &self.prefix {
+ if let Ok(stripped) = bindir.strip_prefix(prefix) {
+ return stripped;
+ }
+ }
}
+ bindir
}
/// Try to find the relative path of `libdir`.