diff --git a/scarb-metadata/src/lib.rs b/scarb-metadata/src/lib.rs index d88e75b5d..aa196655a 100644 --- a/scarb-metadata/src/lib.rs +++ b/scarb-metadata/src/lib.rs @@ -137,6 +137,13 @@ pub struct Metadata { pub target_dir: Option, /// Path to the manifest of package or workspace that Scarb has been run from. + /// + /// ## Compatibility + /// + /// With very old Scarb versions (`<0.5.0`), this field may end up being empty path upon + /// deserializing from `scarb metadata` call. + /// In this case, fall back to [`WorkspaceMetadata.manifest`][WorkspaceMetadata] field value. + #[serde(default)] pub runtime_manifest: Utf8PathBuf, /// Current workspace metadata. diff --git a/utils/scarb-ui/src/args/packages_filter.rs b/utils/scarb-ui/src/args/packages_filter.rs index 4bcbd3f43..2daa6d37b 100644 --- a/utils/scarb-ui/src/args/packages_filter.rs +++ b/utils/scarb-ui/src/args/packages_filter.rs @@ -226,6 +226,11 @@ impl PackagesSource for Metadata { } fn runtime_manifest(&self) -> Utf8PathBuf { - self.runtime_manifest.clone() + let path = self.runtime_manifest.clone(); + if !path.as_str().is_empty() { + path + } else { + self.workspace.manifest_path.clone() + } } }