|
1 | 1 | //! FIXME: write short doc here |
2 | 2 |
|
3 | | -use std::{ffi::OsStr, ops, path::Path, process::Command}; |
| 3 | +use std::{ |
| 4 | + ffi::OsStr, |
| 5 | + ops, |
| 6 | + path::{Path, PathBuf}, |
| 7 | + process::Command, |
| 8 | +}; |
4 | 9 |
|
5 | 10 | use anyhow::{Context, Result}; |
6 | 11 | use cargo_metadata::{BuildScript, CargoOpt, Message, MetadataCommand, PackageId}; |
@@ -308,9 +313,13 @@ pub fn load_extern_resources( |
308 | 313 | if let Ok(message) = message { |
309 | 314 | match message { |
310 | 315 | Message::BuildScriptExecuted(BuildScript { package_id, out_dir, cfgs, .. }) => { |
311 | | - let out_dir = AbsPathBuf::assert(out_dir); |
312 | | - res.out_dirs.insert(package_id.clone(), out_dir); |
313 | | - res.cfgs.insert(package_id, cfgs); |
| 316 | + // cargo_metadata crate returns default (empty) path for |
| 317 | + // older cargos, which is not absolute, so work around that. |
| 318 | + if out_dir != PathBuf::default() { |
| 319 | + let out_dir = AbsPathBuf::assert(out_dir); |
| 320 | + res.out_dirs.insert(package_id.clone(), out_dir); |
| 321 | + res.cfgs.insert(package_id, cfgs); |
| 322 | + } |
314 | 323 | } |
315 | 324 | Message::CompilerArtifact(message) => { |
316 | 325 | if message.target.kind.contains(&"proc-macro".to_string()) { |
|
0 commit comments