-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
A-cargo-apiArea: cargo-the-library API and internal code issuesArea: cargo-the-library API and internal code issuesC-bugCategory: bugCategory: bug
Description
Problem
I'm using cargo as dependency in my project. The function Workspace::new used with relative manifest_path does return error with message invalid path url `` . The same code, but using absolute manifest_path is working correctly.
Steps
- Create project and add cargo as a dependency
- Try to load workspace using relative
manifest_path
Possible Solution(s)
If it's expected behavior it should be mentioned in documentation. Otherwise Workspace::new could transform relative path to absolute before using it.
Notes
Output of cargo version: dependency is defined like that cargo = "0.40".
Example code that isn't working:
use cargo::core::Workspace;
use cargo::Config;
fn main() {
let manifest_path = "Cargo.toml";
let config = Config::default().unwrap();
let workspace = Workspace::new(manifest_path.as_ref(), &config).unwrap();
for member in workspace.members() {
println!("{}", member.name());
}
}Example of working code:
use cargo::core::Workspace;
use cargo::Config;
use std::env;
fn main() {
let manifest_path = env::current_dir().unwrap().join("Cargo.toml");
let config = Config::default().unwrap();
let workspace = Workspace::new(&manifest_path, &config).unwrap();
for member in workspace.members() {
println!("{}", member.name());
}
}Metadata
Metadata
Assignees
Labels
A-cargo-apiArea: cargo-the-library API and internal code issuesArea: cargo-the-library API and internal code issuesC-bugCategory: bugCategory: bug